It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Increment a custom field with jira-python from services running asynchronously

Hi all,

I have a custom field in a task that I want to increment by 1 by a remote service.
That service will have several instances running asynchronously, and each needs to increment the field by 1 when it's done. The field represents the number of times the services ran. Once the field reaches a certain value the task will transition to the next status.

The only option I've found is to get the field's value, increment it by 1 and update it.
My issue with this solution is that it is not thread-safe and the services updating the field may retrieve false values.

Is there a better solution?
Is it possible to use a different mechanism or something other than a counter field to achieve the same result?

Thanks

1 answer

1 accepted

0 votes
Answer accepted
brbojorque Community Leader Dec 22, 2019

Hi @Shay Yacobinski ,

It does not make much sense to do the count on the issue level. 

My approach would be to:

  • Do the counting in the script/service and when it reached a specific count you then transition the ticket.
  • So the only action to be performed by the ticket is transitioning and not updating the value.
  • Add a comment when it is successfully transitioned.

Let me know if it makes sense.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you