You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Yes, I want to wait for 2 events and continue any of the two events is received. If no event is received then longest of both timeouts should hit and I should get null.
Describe the solution you'd like
want to wait for 2 events and continue any of the two events is received. If no event is received then longest of both timeouts should hit and I should get null.
Describe alternatives you've considered
Following code is not going to work because promises don't work in inngest as normal promises and are not allowed.
constwaitForStampUploaded=async()=>{returnnewPromise((resolve,reject)=>{// Wait for 1000 mssetTimeout(()=>{resolve({"data": {"status": "success",}});},1000);});}constwaitForStampSkipped=async()=>{returnnewPromise((resolve,reject)=>{// Wait for 1000 mssetTimeout(()=>{resolve({"data": {"status": "skipped",}})},1200);setTimeout(()=>{resolve(null)},1000);});}conststampStatus=()=>{// Wait for stampUploaded promise or stampSkipped promise// If any of the promise is resolved with not null value, return the value// If any of the promise is resolved with null value, wait for the other promise to // Check if it is resolved with null value or not// If both are null then return null// If any of the promise is resolved with not null value, return the value// We must wait for both the promises to resolve in parallelreturnnewPromise((resolve)=>{letstampUploadedPromise=waitForStampUploaded();letstampSkippedPromise=waitForStampSkipped();letisStampUploadedResolved=false;letisStampSkippedResolved=false;stampUploadedPromise.then((response)=>{isStampUploadedResolved=true;if(response!=null){resolve(response);}else{if(isStampSkippedResolved){resolve(null);}}});stampSkippedPromise.then((response)=>{isStampSkippedResolved=true;if(response!=null){resolve(response);}else{if(isStampUploadedResolved){resolve(null);}}});});}/**--------------------------------| success | skip | output |--------------------------------| 0 | 1 | 1 || 1 | 0 | 1 || 1 | 1 | 1 || 0 | 0 | 0 |-------------------------------- */
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Yes, I want to wait for 2 events and continue any of the two events is received. If no event is received then longest of both timeouts should hit and I should get null.
Describe the solution you'd like
want to wait for 2 events and continue any of the two events is received. If no event is received then longest of both timeouts should hit and I should get null.
Describe alternatives you've considered
Following code is not going to work because promises don't work in inngest as normal promises and are not allowed.
The text was updated successfully, but these errors were encountered: