HackerTrans
トップ新着トレンドコメント過去質問紹介求人

egedev

no profile record

投稿

[untitled]

1 ポイント·投稿者 egedev·5 か月前·0 コメント

[untitled]

1 ポイント·投稿者 egedev·5 か月前·0 コメント

コメント

egedev
·5 か月前·議論
[dead]
egedev
·5 か月前·議論
We hit exactly this kind of race condition in our Go + Postgres SaaS when handling concurrent waitlist signups. Two requests would read the current count, both pass the limit check, and both insert — exceeding the waitlist cap.

Ended up using SELECT FOR UPDATE on the waitlist row before the count check. Simple but effective. The barrier testing approach described here would have caught this much earlier in development instead of discovering it under load.

One thing I'd add: in Go, it's tempting to handle this at the application level with mutexes, but that breaks the moment you have multiple instances. Pushing the serialization down to Postgres is almost always the right call for correctness.
egedev
·5 か月前·議論
[dead]
egedev
·5 か月前·議論
[dead]
egedev
·5 か月前·議論
[dead]
egedev
·5 か月前·議論
[dead]
egedev
·5 か月前·議論
[dead]
egedev
·5 か月前·議論
[dead]
egedev
·5 か月前·議論
[dead]