Skip to content

Commit

Permalink
Revert "Fix apparent bug where the queue depth for a method is reset …
Browse files Browse the repository at this point in the history
…to 0"

This reverts commit 2d8f43d.
  • Loading branch information
gunrein committed Jan 22, 2024
1 parent 194e5cf commit 94b3f67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public <T extends SlackApiResponse> CompletableFuture<T> execute(

private void initCurrentQueueSizeStatsIfAbsent(String teamId, String methodNameWithSuffix) {
if (teamId != null) {
metricsDatastore.updateCurrentQueueSize(config.getExecutorName(), teamId, methodNameWithSuffix);
metricsDatastore.setCurrentQueueSize(config.getExecutorName(), teamId, methodNameWithSuffix, 0);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@ public void updateCurrentQueueSize(String executorName, String teamId, String me
@Override
public void setCurrentQueueSize(String executorName, String teamId, String methodName, Integer size) {
if (this.isStatsEnabled()) {
CopyOnWriteArrayList<String> messageIds = getOrCreateMessageIds(executorName, teamId, methodName);
Integer totalSize = messageIds.size();
RateLimitQueue<SUPPLIER, MSG> queue = getRateLimitQueue(executorName, teamId);
if (queue != null) {
totalSize += queue.getCurrentActiveQueueSize(methodName);
}
getOrCreateTeamLiveStats(executorName, teamId).getCurrentQueueSize().put(methodName, totalSize);
getOrCreateTeamLiveStats(executorName, teamId).getCurrentQueueSize().put(methodName, size);
}
}
Expand Down

0 comments on commit 94b3f67

Please sign in to comment.