10/10 #BuildInPublic
made a tiny browser demo for this. you can drop the reply after a charge, recover it, then race two retries and watch the charge count.
go break it → https://t.co/Z8QuGAewUB
9/10 #BuildInPublic
ran the whole thing in the terminal. pay timed out, so i opened a fresh cli and ran reconcile. pending → paid.
ran it again for good measure. nothing to do.
9/10 #BuildInPublic
ran the whole thing in the terminal. pay timed out, so i opened a fresh cli and ran reconcile. pending → paid.
ran it again for good measure. nothing to do.
8/10 #BuildInPublic
threw 24 requests for the same payment at it all at once. 23 got back the charge from the one that won.
checked the db anyway. one row lol
@pintonotes reconcile first! it checks the provider using the same payment ID. in this case the 499 charge is already there, so it just marks it paid. it only retries if the provider returns 404. 8/10 is where i race two of those retries :)
7/10 #BuildInPublic
finally got the failure i wanted. made the provider save the charge and wait 2s before replying.
the cli timed out. sqlite already had the 499 charge.
6/10 #BuildInPublic
what if the first request never got there? i retry with the same id and amount. even if the first request shows up late, both attempts land on one charge.
8/10 #BuildInPublic
threw 24 requests for the same payment at it all at once. 23 got back the charge from the one that won.
checked the db anyway. one row lol
7/10 #BuildInPublic
finally got the failure i wanted. made the provider save the charge and wait 2s before replying.
the cli timed out. sqlite already had the 499 charge.
6/10 #BuildInPublic
what if the first request never got there? i retry with the same id and amount. even if the first request shows up late, both attempts land on one charge.
5/10 #BuildInPublic
added reconcile. i can open a new terminal and ask the provider if that pending payment went through. if it did, the cli marks it paid right there ;)
5/10 #BuildInPublic
added reconcile. i can open a new terminal and ask the provider if that pending payment went through. if it did, the cli marks it paid right there ;)
3/10 #BuildInPublic
made the app save the payment before it sends anything. if i kill the cli halfway through, the next run still knows which payment it was trying to make.
1/10 #BuildInPublic
started a little project called schrödinger’s charge
you pay 499, the payment goes through and the app says timed out. would you hit pay again?
3/10 #BuildInPublic
made the app save the payment before it sends anything. if i kill the cli halfway through, the next run still knows which payment it was trying to make.
@ozkanceng yep, i made the payment id the primary key in the provider’s sqlite db. even if two workers both see a 404 and retry, one creates the charge and the other gets that same charge back
1/10 #BuildInPublic
started a little project called schrödinger’s charge
you pay 499, the payment goes through and the app says timed out. would you hit pay again?
@progerallworld yep, that’s one of the demo scenarios. the provider saves the charge and replies too late. the app checks with the provider, finds the original charge and marks it paid. still one row in sqlite :)
@zonbuilds yep, same key on every retry. my favorite case in the demo is when the original request arrives after the retry and you still only get charged once