Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9188493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:01:18+00:00 2026-06-17T20:01:18+00:00

Looking for some advice on how to do the following: Receive request from website

  • 0

Looking for some advice on how to do the following:

  1. Receive request from website for certain long running process (~10-30seconds)
  2. Website backend schedules a job and puts onto distributed queue .. could be SQS/Kue/resque
  3. A worker takes the job off the queue and processes it. Stores result somewhere.
  4. Website backend subscribes to job complete event and gets the result of processed job.
  5. Website backend closes request to website with result of the task.

1,2 and 3 are fine. I am just finding it tricky to pass the result of a queued task back to the backend so that it can close the request.

Polling from the website isnt an option – the request has to stay open for however long the task takes to be processed. I’m using nodejs.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:01:19+00:00Added an answer on June 17, 2026 at 8:01 pm

    2 – 4 are all happening on the server side. There is nothing stopping you from polling the expected result location (on the server side) for the result and then returning the result when it finally appears.

    1. Client sends requests
    2. Server starts job and begins polling for the result
    3. The result comes back so the poll loop on the server side ends
    4. Server sends result back to client
    5. The client-server connection is finally severed

    You could get even more efficient code going if the job can execute a url when it finishes. In this case your service would have two endpoints… one for the client to start the process, and another that your job queue can call.

    1. Client sends requests
    2. Server starts job… saves the response callback in a global object so that it is not closed (I’m assuming something like express here)

      openJobs.push({ id: 12345, res: res });
      jobQueue.execute({ id: 12345, data: {…}});

    3. When the job finishes and saves the result, call the service url with the id

    4. You can check that the job has actually finished and remove the job from the openJobs list
    5. Finish the original response

      openJob.res.send(data);

    6. This will send the data and close the original client-server connection.

    The overall result is that you have no polling at all… which is cool.

    Of course… In either of these scenarios you are screwed if your server shuts down in the middle of a batch… This is why I would recommend something like socket.io in this scenario. You would queue the results of jobs somewhere and socket.io would poll/wait for callbacks on the list and push to the client when there are new items. This is better because if the server crashes no biggie – the client will re-connect once the server comes back up.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for some advice on how to optimise the following process: App reads
I'm looking for some advice on if the following is possible I know it's
I'm looking for some advice for the following. I need to create a DAL
All, I'm looking for advice over the following scenario: I have a component running
I am looking for some refactoring / Best practice advice on the following code.
I'm looking for some advice to how to get the indexes running better on
I'm looking for some advice from anyone who has experience writing addons for PowerPoint
I'm looking for some advice from the community about constructing an online store based
looking really for some advice on how i should handle the following scenario. i
Looking for some advice on the best way to implement localization along with client

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.