Skip to content

Instantly share code, notes, and snippets.

@dontpaniclabsgists
Created January 17, 2025 14:32
Show Gist options
  • Save dontpaniclabsgists/5d7480c05f51bb7c5a38a98e45a3c2bc to your computer and use it in GitHub Desktop.
Save dontpaniclabsgists/5d7480c05f51bb7c5a38a98e45a3c2bc to your computer and use it in GitHub Desktop.
loadWithPromiseLockNoDataCheck = async (key: string): Promise<boolean> => {
this.log(key + 'Calling loadWithPromiseLock No Data Check');
const random = Math.random();
this.log(key + 'Random: ' + random);
// Create a new loading promise
return (async () => {
this.log(key + '***START*** Loading data');
await this.slowApiCall(key);
this.promiseDataMap.set(key, 'data + ' + random);
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