Concurrency & Idempotency

Serialize multiplayer server state mutations with per-table mutexes and idempotency guards.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/kerem-ersoz/gonul --skill concurrency-idempotency
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Concurrency & Idempotency
Source: https://github.com/kerem-ersoz/gonul/tree/main/.github/skills/concurrency
Command: npx skills add https://github.com/kerem-ersoz/gonul --skill concurrency-idempotency

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Server-side mutations across many concurrent actions can race and corrupt shared state. This Skill provides per-table locking and idempotency guards to ensure serialized, safe transitions for game state mutations in a multiplayer server.

Core Features & Use Cases

  • Per-table mutexes to serialize mutations
  • Idempotency guards in state-changing methods
  • Safe handling of sockets, timers, and bot actions to prevent races
  • Clear guidance for timer safety, check-then-act prevention, and atomic state transitions

Quick Start

Wrap mutations with withTableLock to serialize changes and enforce idempotency.

Frequently Asked Questions about Concurrency & Idempotency

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent race conditions during concurrent server state mutations?

Prevent race conditions during concurrent server state mutations by applying a per-table mutex and wrapping logic in the withTableLock pattern to serialize access. This ensures safe transitions for multiplayer game state without corrupting shared data.

How do I enforce idempotency in multiplayer game servers?

Enforce idempotency in multiplayer game servers by adding idempotency guards directly inside state-changing game methods. This prevents duplicate socket actions or bot schedules from triggering repeated state transitions on the same table.

What is the best way to handle server concurrency for sockets and timers?

Handle server concurrency for sockets and timers by using per-table locking alongside dedicated timer safety controls. This prevents check-then-act race conditions and ensures atomic state transitions across bot scheduling and player connections.

Why do concurrent bot actions and player connections corrupt shared game state?

Concurrent bot actions and player connections corrupt shared game state because overlapping socket events execute unserialized mutations. Applying a per-table mutex serializes these transitions, ensuring safe state changes across concurrent server actions.

How do I safely lock game state for atomic transitions in a multiplayer server?

Safely lock game state for atomic transitions by acquiring a per-table mutex before executing mutations. Use the withTableLock pattern to wrap game methods, enforcing serialized execution and preventing concurrent access to shared state.