-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add delay #459
fix: add delay #459
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The typical approach for this kind of problem is using things like transactions to make sure the change is completed rather than setting a timeout.
@mfenner are you aware of a standard implementation for transactions in Ember? All I have seen its a kind of convoluted promise patterns. |
This is about transactions in databases and Elasticsearch. At the end of the day, the problem is a problem of our backend service, so I would try to fix it there first. |
I had a look at this too, while it'd be nice to have the backend handle this, I'm not sure how we'd approach with our current infrastructure, the indexing happens on the background queue right? and therefore you're not going to know without querying, its not a transaction in the sense of database transactions where you know the commit is successful. We could maybe change the way the update call is made for the prefix change and have that wait a little bit, or yes do a query again to see if its updated, but then this isn't ideal. Another way to look at this might be that if we assume that the transaction is "successful" by very nature of the 200 received, i.e. it will update the index. We could update the ember model store directly to add the prefix assigned rather than relying on having to refresh to get the assignment. |
This is a concurrency problem so I think the solution should address that. For example re-fetching a single prefix before assigning it to a member or repository. This info could come straight from the database and not Elasticsearch. |
Closing this in favor of datacite/lupo#642 which addresses the concurrency issue in the API. Briefly, the Elasticsearch index update is done during the update, not in a background job. Keeping the delay in Fabrica from this issue. |
Purpose
Fix refreshing after adding prefix.
closes: #422
Approach
Adding delay to let ES index the change completely.
Open Questions and Pre-Merge TODOs
Learning
It's not related to the store or the model being reload/refresh but the ES index be updated.
Types of changes
Reviewer, please remember our guidelines: