0

I'm new to Firebase and trying to set up a task queue. My objective is to read requests with a 'pending' status from a datastore queue, send an HTTP request to an external third-party server, and then update the request status to 'ready'. The external server has a response time of around 5-10 seconds and does not support parallel calls, so I have to ensure that only one request is being processed at a time.

I tried the following approaches:

Triggered Function: I attempted to trigger a Cloud Function when a new record is added to the queue repository. I expected this to work, but it led to parallel processing, which is not supported by the external server.

Scheduled Job: Another option I considered was running a scheduled job. However, Firebase's minimum scheduling time is one minute, which is too long for my use case where each request takes 5-10 seconds to process.

Cloud Tasks: I also looked into Cloud Tasks, but I don't see how it would be applicable since I'm dealing with an external third-party service.

I was expecting to find a method to process each request one at a time while adhering to the timing requirements.

1 Answer 1

1

You can use Cloud Tasks to set up a queue that's limited to 1 concurrent dispatch. You provide the code to deal with the third party service as an HTTP endpoint that Cloud Tasks will invoke for each request in the queue.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.