Skip to content

Commit

Permalink
Fix priority calculation for local queue
Browse files Browse the repository at this point in the history
  • Loading branch information
masokol committed Aug 16, 2023
1 parent 751844e commit fcc5a05
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Version 1.0.8 (Not yet released)

* Fix priority calculation for local queue - Issue #546
* Fix repair job priority - Issue #515
* Fix malformed IPv6 for JMX - Issue #306
* Step karaf to 4.2.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ public Iterator<ScheduledTask> iterator()

for (ReplicaRepairGroup replicaRepairGroup : repairStateSnapshot.getRepairGroups())
{
taskList.add(new RepairGroup(getRealPriority(), myTableReference, myRepairConfiguration,
taskList.add(new RepairGroup(getRealPriority(replicaRepairGroup.getLastCompletedAt()),
myTableReference, myRepairConfiguration,
replicaRepairGroup, myJmxProxyFactory, myTableRepairMetrics,
myRepairLockType.getLockFactory(),
new RepairLockFactoryImpl(), myRepairPolicies));
Expand Down Expand Up @@ -181,12 +182,16 @@ else if (msSinceLastRepair >= myRepairConfiguration.getRepairWarningTimeInMs())
@Override
public boolean runnable()
{
try
{
myRepairState.update();
} catch (Exception e)
if (nextRunTimePassed())
{
LOG.warn("Unable to check repair history, {}", this, e);
try
{
myRepairState.update();
}
catch (Exception e)
{
LOG.warn("Unable to check repair history, {}", this, e);
}
}

RepairStateSnapshot repairStateSnapshot = myRepairState.getSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,17 @@ public final void setRunnableIn(long delay)
*/
public boolean runnable()
{
return myNextRunTime <= System.currentTimeMillis() && getRealPriority() > -1;
return nextRunTimePassed() && getRealPriority() > -1;
}

/**
* Check if next time to run has passed.
*
* @return True if next time to run has passed.
*/
public boolean nextRunTimePassed()
{
return myNextRunTime <= System.currentTimeMillis();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ int size()
@Override
public synchronized Iterator<ScheduledJob> iterator()
{
myJobQueues.values().forEach(q -> q.forEach(ScheduledJob::runnable));
Iterator<ScheduledJob> baseIterator = new ManyToOneIterator<>(myJobQueues.values(), myComparator);

return new RunnableJobIterator(baseIterator);
Expand Down

0 comments on commit fcc5a05

Please sign in to comment.