Race Condition? #303
Replies: 6 comments 10 replies
-
Hey! This was reported previously but I couldn't reproduce it: https://github.com/jokob-sk/Pi.Alert/issues/259 Happy for you to try to investigate? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
-
Migrating to a different DB is not something I'm considering as I'm unsure if the issue gets solved that way. Also, it's not that big of an issue and this can be mitigated by running Pholus less frequently. I like the simplicity of a SQLlite deployment as well as backups are more straightforward. If rather solve the underlying issue or build in a delay for the Pholus scan. |
Beta Was this translation helpful? Give feedback.
-
I'm also moving a lot of the DB access to the API endpoints so the DB isn't used as frequently as it is right now. |
Beta Was this translation helpful? Give feedback.
-
I think I found the race. In device.py update_devices_names. The first thing it does is select all the It then does stuff that can take quite a bit of time, in my case its taking 60 seconds or so. And then without checking to see if the record has been updated in the meantime writes over the top of the records with names that were not found (line 464) with the name Combining this with the 5 second sleep in the main loop means that unless you write in that 5 seconds, any change is going to be overwritten. Situation is worse the more I can work on a patch tonight and submit a pull request. I'm thinking of an approach where rather than validate each record hasn't changed instead only update the records where the name is changing. So |
Beta Was this translation helpful? Give feedback.
-
Followup to my own question: |
Beta Was this translation helpful? Give feedback.
-
Thank you both very much for your hard work on this. I noticed this as well and I thought it was normal that names would revert back to default after scans. |
Beta Was this translation helpful? Give feedback.
-
When editing a device name, the change doesn't seem to persist...maybe even most of the time. The change will say it's successful, jumping back to the devices view will show it as successful, but then a few minutes later I'll refresh and notice that it's changed back to whatever the name was originally detected to be. Every once in a while it'll take...and once that happens it sticks.
I didn't create an Issue for this yet, I wanted to make sure this isn't expected behavior where Pholus always overwrites the name with what it detects or something? But again it sticks sometimes...so maybe not.
Beta Was this translation helpful? Give feedback.
All reactions