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

Invoice creation is non-idempotent, resulting in possible duplicate invoices #25

Open
joshmcclain opened this issue Mar 5, 2024 · 0 comments
Assignees

Comments

@joshmcclain
Copy link
Contributor

It seems like two invoice creation attempts ran concurrently, causing duplicate invoices for some projects to be created in Quickbooks. Which projects were duplicated seems to be a function of whether the earlier creation attempt had completed for a particular project by the time the second attempt began running.

This line in InvoiceTracker.rb is intended to bail out of invoice generation if a prior QuickBooks invoice is already assigned to the invoice tracker model. However, since this association is only updated at the end of an invoicing run, it's possible for two runs to detect that no invoice exists, and then race each other for completion.

This line in Stacks::Automator intends to do the same thing (checking whether the invoice pass is marked as complete), but suffers from the same potential race condition.

We should probably have an idempotent guard / soft lock on the invoice pass model indicating whether invoice creation is in progress.

@joshmcclain joshmcclain self-assigned this Mar 5, 2024
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

No branches or pull requests

1 participant