Monday 24 August 2020

How to make sure my variables are initialised when used by different routes?

My API has 2 different routes :1 for the end user where they post the data they want and then trigger GitLab pipelines where I fetch the triggered pipeline id and the job id's within the pipeline.1 is for the GitLab webhook I've integrated.I got 2 variables : pipelineId and jobId.They're global variables since I use them in both routes. They are both initially empty, but then initialised in the first route.The first route fetches them within the response body after the trigger and I want to use them to fetch a specific job's logs in the 2nd route. However, I end up with empty variables since both routes are executing themselves in parallel. Now, my question is how to make sure my variables are initialised by the 1st route when used in the 2nd route.This is the code I'm working on

Submitted August 24, 2020 at 03:02PM by TheMemeExpertExpert

No comments:

Post a Comment