Skip to content
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

Closed
wants to merge 3 commits into from
Closed

fix: add delay #459

wants to merge 3 commits into from

Conversation

kjgarza
Copy link
Contributor

@kjgarza kjgarza commented Sep 15, 2020

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Reviewer, please remember our guidelines:

  • Be humble in the language and feedback you give, ask don't tell.
  • Consider using positive language as opposed to neutral when offering feedback. This is to avoid the negative bias that can occur with neutral language appearing negative.
  • Offer suggestions on how to improve code e.g. simplification or expanding clarity.
  • Ensure you give reasons for the changes you are proposing.

@kjgarza kjgarza self-assigned this Sep 15, 2020
Copy link
Contributor

@mfenner mfenner left a 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.

@kjgarza
Copy link
Contributor Author

kjgarza commented Sep 22, 2020

@mfenner are you aware of a standard implementation for transactions in Ember? All I have seen its a kind of convoluted promise patterns.

@mfenner
Copy link
Contributor

mfenner commented Sep 22, 2020

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.

@richardhallett
Copy link
Contributor

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.

@mfenner
Copy link
Contributor

mfenner commented Sep 24, 2020

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.

@mfenner
Copy link
Contributor

mfenner commented Sep 27, 2020

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.

@mfenner mfenner closed this Sep 27, 2020
@mfenner mfenner deleted the fix_refresh_prefix branch February 3, 2021 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refresh view when assigning or removing prefix
3 participants