Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Add jitter to workflowoffset time #3305

Merged
merged 3 commits into from
Oct 18, 2022
Merged

Add jitter to workflowoffset time #3305

merged 3 commits into from
Oct 18, 2022

Conversation

skorse
Copy link
Contributor

@skorse skorse commented Oct 18, 2022

Pull Request type

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes (Please run ./gradlew generateLock saveLock to refresh dependencies)
  • WHOSUSING.md
  • Other (please describe):

NOTE: Please remember to run ./gradlew spotlessApply to fix any format violations.

Changes in this PR
Add a jitter to the default wokflowOffsettime to spread out the load on the queue.

Describe the new behavior from this PR, and why it's needed
Issue #

Alternatives considered

Describe alternative implementation you have considered

@skorse skorse changed the title add jitter to workflowoffset time Add jitter to workflowoffset time Oct 18, 2022
}
break;
}
}
queueDAO.setUnackTimeout(
DECIDER_QUEUE, workflowModel.getWorkflowId(), postponeDurationSeconds * 1000);
}

@VisibleForTesting
long workflowOffsetWithJitter(long workflowOffsetTimeout) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add more details (comments) about how large the value of jitter can be?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added few lines of comment in the code. Basically, the jitter will be +- 1/3 of workflowoffset value. For 2700 seconds offset, the range of the offset will be between 1800-3600

@aravindanr aravindanr merged commit 4ee0203 into main Oct 18, 2022
@aravindanr aravindanr deleted the tasks/MWI-4643 branch October 18, 2022 22:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants