Idempotent Rails Requests with a Redis Semaphore Lock
How to stop duplicate Rails requests from creating the same record twice, using a Redis-backed semaphore lock instead of chasing a race condition.
254 posts. Browse by category or tag, or use search.
How to stop duplicate Rails requests from creating the same record twice, using a Redis-backed semaphore lock instead of chasing a race condition.
How British Summer Time breaks Ruby tests, cron schedules, and cloud functions that assume UTC, and how to write timezone-aware specs instead.
The code review anti-patterns that slow teams down most: giant PRs, style-war comments, and reviews that skip the business context entirely.
How Redis Sentinel split-brain happens during Kubernetes node maintenance, and the sentinel tuning, anti-affinity, and PDB changes that stopped it.
How to debug a "No Signal" or "No SIM" error on a Xiaomi phone, from dialer diagnostic codes through ADB logcat filters to EFS partition failures.
A practical rundown of Zsh command-line editing: ZLE widgets, history reuse, globbing, and the handful of plugins that actually save keystrokes.
本文用 Ruby 代码示例,剖析 DRY 与 AHA、YAGNI 与可扩展性设计、继承与组合等几对看似冲突的编程原则,说明该如何在实践中权衡取舍。
A working GitHub Actions workflow that builds a Docker image and pushes it to Quay.io using a scoped robot account and repository secrets.
A Rails test suite hung intermittently until transactional tests, ActiveJob, and ActiveStorage turned out to be racing over the same locked rows.
Runtime method overrides work very differently in PHP and Ruby: one has no rollback mechanism, the other builds aliasing and scoping in from the start.