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(config): fix race condition in config file #381

Merged
merged 11 commits into from
Jul 30, 2021
Merged

Conversation

olamothe
Copy link
Member

@olamothe olamothe commented Jul 26, 2021

https://coveord.atlassian.net/browse/CDX-509

Proposed changes

One time out of ~20, I would locally reproduce the problem and get errors manipulating the configuration while executing the analytics hook. I would end up with an empty config file.

In the analytics hook, there's some logic to access the config and to write the current visitorID (through the coveo.analytics library).

By moving to a sync method to write the new config content, everything seems 👍, and I can't reproduce by running the analytics hooks multiple times (~100) in quick succession.

Testing

  • Manual Tests:

Sorry, something went wrong.

Unverified

This user has not yet uploaded their public signing key.
Copy link
Collaborator

@louis-bompart louis-bompart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UT needs to be updated ;)

Also, while at it from what I checked, I think the file could be put 'sync' because readJson etc as Sync alternative.

Why not do that while at it?

Copy link
Contributor

@y-lakhdar y-lakhdar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@louis-bompart louis-bompart merged commit a65395d into master Jul 30, 2021
@louis-bompart louis-bompart deleted the CDX-509 branch July 30, 2021 19:58
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.

None yet

3 participants