π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
feat: promise race for long requests
Nevo David0d231545ecd4
diff --git a/libraries/helpers/src/utils/concurrency.service.ts b/libraries/helpers/src/utils/concurrency.service.tsindex c92b39157..99ee82fa3 100644--- a/libraries/helpers/src/utils/concurrency.service.ts+++ b/libraries/helpers/src/utils/concurrency.service.ts@@ -19,17 +19,19 @@ export const concurrency = async <T>(maxConcurrent,datastore: 'ioredis',connection,+ minTime: 1000,});let load: T;try {- load = await mapper[strippedIdentifier].schedule<T>(- { expiration: 120_000 },- async () => {- const res = await func();- await timer(1000);- return res;- }- );+ load = await mapper[strippedIdentifier].schedule<T>(async () => {+ return await Promise.race<T>([+ new Promise<T>(async (res) => {+ await timer(300000);+ res(true as T);+ }),+ func(),+ ]);+ });} catch (err) {}return load;