An idempotent system produces the same externally relevant result when the same task runs more than once. A mathematical function may be idempotent while its service is unsafe: repeated processes can still overwrite a shared output. section 8.2
Make repeated work safe by:
- Giving each task or entity a unique identifier. section 8.2
- Including a unique ID or timestamp in generated filenames so concurrent processes do not overwrite one another. section 8.2
- Coordinating multiple workers through routing and system-level mechanisms, such as a load balancer. section 8.2
Concurrent image generation
Running two copies of an application can make both produce single.png, leaving one result after the files overwrite each other. Naming outputs with a unique ID or timestamp preserves each task's result. section 8.2
Listing 8.3 Console: Running multiple processes at once
python main.py & python main.py
Run the same Python process twice to reproduce the concurrent-work scenario that exposes unsafe shared outputs. section 8.2
















