Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleOnce ¶
func HandleOnce(jobId string, instanceId string, handleCallback func(string), db *mongo.Database, ts timestamper.ITimeStamper, logger logger.ILogger) error
Call this to ensure this is handled ONCE among all API instances. It requires a "jobId", but this can be any unique string attributed to the task being handled. It also requires an instanceId (of this running API instance). Internally this works by writing our instance ID to DB, waiting a bit, then reading it back. If it wasn't overwritten by another API instance, we are the handler, and handleCallback is called, otherwise we see the instance ID is not ours and we stop further processing.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.