Epic link custom field not working in new thread

We are working on the possibility of cloning the epic with its related tasks asynchronously (triggered by the internal rest API - which is finally executed on our java backend).

Simply. For some reason, linking epic-linked issues to the cloned epic in the asynchronous approach (new thread) doesn’t work. Works synchronously.
Connecting is done by first create a new epic and then properly preparing linked issues before creating them - assigning them a custom field com.pyxis.greenhopper.jira: gh-epic-link with the epic object.

Less simply.
How it works now:

  • sending the request from the frontend
  • synchronously executing rest API, i.e. cloning epic with its linked issues assigning to each of the linked issues custom field com.pyxis.greenhopper.jira: gh-epic-link with new parent (epic)
  • return from the rest API of the new epic key

We now want the request on the backend to be executed asynchronously to be able to inform the user about the cloning progress of other requests. So it would look like this:

  • sending the request from the frontend
  • asynchronous handling of the called rest api i.e.
  • calling a new thread that performs exactly the same actions as in the synchronous approach
  • after creating a new thread and starting it, immediately return the taskId to the frontend
  • frontend asks every few seconds for the status of the task with the given taskId
  • when the task is fully completed, a new issue key is returned

In the first scenario, everything works as it should.
In the second scenario - the one we’re aiming for - everything works fine except for creating a connection between the epic and the new epic linked issues.
The connection as well as all the other staff is created with all the same code as in the first scenario.
The only thing that distinguishes these two approaches is the way the new thread (all things are done in one thread) is called inside rest synchronously vs asynchronously.
In the second try, we also tried to create an epic and all linked issues first and then link to each other in the same thread but it still doesn’t work.

Does anyone have any idea how to make it work?

1 Like