Skip to content

Instantly share code, notes, and snippets.

@dontpaniclabsgists
Created January 17, 2025 14:37
Show Gist options
  • Save dontpaniclabsgists/8ee21f0a55dec514bfc0f62d2c1fbf3d to your computer and use it in GitHub Desktop.
Save dontpaniclabsgists/8ee21f0a55dec514bfc0f62d2c1fbf3d to your computer and use it in GitHub Desktop.
loadWithMutexLockNoDataCheck = async (key: string): Promise<boolean> => {
this.log(key + 'Calling loadWithMutexLock No Data Check');
return this.mutex.runExclusive(async () => {
this.log(key + '***START*** Loading data');
await this.slowApiCall(key);
this.mutexDataMap.set(key, 'data');
this.log(key + '***END*** Data loaded');
return true;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment