Description
The distributed lock in src/utils/lock.ts:13-19 uses PX ttlMs with a 10s default TTL. Stellar contract invocations involve Horizon load, simulation, and submission — easily exceeding 10s. When TTL expires, Redis auto-releases the lock, and a concurrent request acquires it, defeating double-claim/double-mint protection.
No lock renewal/heartbeat mechanism exists.
Impact
Mutual exclusion is lost for any operation exceeding 10s. Critical for reward claiming and credential minting which call external Stellar APIs.
File
src/utils/lock.ts:13-19
Called by: src/modules/rewards/reward.service.ts:93, src/modules/credentials/credential.service.ts:30
Suggested Fix
Increase the default TTL (e.g., 30s) and implement a heartbeat/renewal mechanism that extends the TTL while the lock holder is still working.
Description
The distributed lock in
src/utils/lock.ts:13-19usesPX ttlMswith a 10s default TTL. Stellar contract invocations involve Horizon load, simulation, and submission — easily exceeding 10s. When TTL expires, Redis auto-releases the lock, and a concurrent request acquires it, defeating double-claim/double-mint protection.No lock renewal/heartbeat mechanism exists.
Impact
Mutual exclusion is lost for any operation exceeding 10s. Critical for reward claiming and credential minting which call external Stellar APIs.
File
src/utils/lock.ts:13-19Called by:
src/modules/rewards/reward.service.ts:93,src/modules/credentials/credential.service.ts:30Suggested Fix
Increase the default TTL (e.g., 30s) and implement a heartbeat/renewal mechanism that extends the TTL while the lock holder is still working.