You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently using this gem in an app with "Tasks" where completed tasks can be moved to the top of the list when "reopened" by updating the row_order_position attribute with the :first value. This works great if, say, I manually reopen completed tasks one per time, however I also have schedules which automatically reopen certain tasks at some point in time, such as every day at midnight, and this happens asynchronously, meaning that it can easily happen that multiple tasks are moved to the top at the same time. This results in multiple tasks having the same rank/position in the list.
Do you know of any way I can avoid this and ensure each task has a unique rank even in the scenario I described? I tried things like locking and transactions with different isolation levels but with no luck (I'm using Postgres).
Thanks in advance!
The text was updated successfully, but these errors were encountered:
It may not solve your problem but per the idea in #95, a unique index on the row_order column would prevent dups. Some kind of code to handle errors would be needed unless your async tasks can retry upon failure.
You could look at an advisory lock. There is a branch with this in it. Though since I'm talking to 2016-17, this is probably not an issue for you anymore...
Hi!
I'm currently using this gem in an app with "Tasks" where completed tasks can be moved to the top of the list when "reopened" by updating the row_order_position attribute with the :first value. This works great if, say, I manually reopen completed tasks one per time, however I also have schedules which automatically reopen certain tasks at some point in time, such as every day at midnight, and this happens asynchronously, meaning that it can easily happen that multiple tasks are moved to the top at the same time. This results in multiple tasks having the same rank/position in the list.
Do you know of any way I can avoid this and ensure each task has a unique rank even in the scenario I described? I tried things like locking and transactions with different isolation levels but with no luck (I'm using Postgres).
Thanks in advance!
The text was updated successfully, but these errors were encountered: