Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cconstab/d80678289e23483ad25324f169c0eaf9 to your computer and use it in GitHub Desktop.
Save cconstab/d80678289e23483ad25324f169c0eaf9 to your computer and use it in GitHub Desktop.
try {
await atClient.put(
mutexKey,
'lock',
putRequestOptions: pro,
);
logger.shout('😎 Will handle request from ${notification.from}'
'; acquired mutex $mutexKey');
} catch (err) {
if (err.toString().toLowerCase().contains('immutable')) {
logger.shout('🤷‍♂️ Will not handle request from ${notification.from}'
'; did not acquire mutex $mutexKey');
return;
} else {
logger.shout('Will not handle; did not acquire mutex $mutexKey : $err');
}
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment