-
Notifications
You must be signed in to change notification settings - Fork 48
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: Invoice number race condition #669
Conversation
@MohamadNateqi check now |
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.
LGTM!
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.
All good!
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 last commit was great.
What do you think of checking that setting here and sending an empty array if it's not checked, instead of adding that in the Semaphore class? Then the log()
method can only check the emptiness of that property.
$lock = new Semaphore( $this->lock_name, $this->lock_time, array( wc_get_logger() ), $this->lock_context ); |
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.
Perfect!
closes #619
This PR attempts to fix the race condition issue spotted using Stripe plugin.
It changes the lock time to
60
seconds, to avoid expiring before the code being finished, and now also adds a lock to the email attachment function as well, which is the primary way of getting duplicated numbers.