3 ms·
> This is good but not enough. You also need to be sure that you can’t charge twice if the job runs twice. When you do that same query twice, you will get the s
by Izkata 6y ago
> This is good but not enough. You also need to be sure that you can’t charge twice if the job runs twice. When you do that same query twice, you will get the same list of users.
That's handled by the extra condition in step 1 of the altered rules:
> which haven't been charged the fee this month.
- glic3rinu 6y agoOP is talking about concurrent execution of the task without serialization on the database (serializable isolation is almost never the default). Which results in 2 concurrent queries getting the same list of customers to charge.