Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Passing req and addon variables to work queue on Heroku

Hung Tran August 8, 2023

I'm implementing a long running job on Heroku.

I am designing a file to handle each job but have a problem passing variables to each job. And pass the req and addon into the workQueue

 

const reqData = stringify(req);

const addonData = stringify(addon);

let job = await workQueue.add({reqData, addonData})

Currently functions are using req and addon variables for processing, but passing to the work queue needs to be parsed into JSON.

I used https://www.npmjs.com/package/flatted to convert them to JSON

In a job process I parsed it back to JSON

const req = parse(reqData);

const addon = parse(addonData);

var httpClient = addon.httpClient(req); // It not found the httpClient after parse to JSON

Parsing to JSON will lose functions in req and addon. It not found the httpClient()

Is there a way to rebuild the HttpClient in the job process? or if anyone has any advice for implementing long job running on Jira connect app, I would greatly appreciate it

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events