Skip to content

Commit

Permalink
fix: Clear the queue before adding new elements
Browse files Browse the repository at this point in the history
Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
  • Loading branch information
o-kopysov committed Feb 21, 2024
1 parent f40dc2b commit 2d29e03
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/lpvs/LicensePreValidationSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static void main(String[] args) {
public TaskExecutor getAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(corePoolSize);
executor.setThreadNamePrefix("LPVS-ASYNC::");
executor.setThreadNamePrefix("LPVS::");
return executor;
}
}
1 change: 1 addition & 0 deletions src/main/java/com/lpvs/service/LPVSQueueService.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public BlockingDeque<LPVSQueue> getQueue() {
* @throws InterruptedException If interrupted while processing the queue.
*/
public void checkForQueue() throws InterruptedException {
QUEUE.clear();
log.debug("Checking for previous queue");
List<LPVSQueue> webhookConfigList = queueRepository.getQueueList();
for (LPVSQueue webhook : webhookConfigList) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/lpvs/LicensePreValidationSystemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void testGetAsyncExecutor() {
assertEquals(executor, mocked_constructed_executor);

verify(mocked_constructed_executor, times(1)).setCorePoolSize(testNumCores);
verify(mocked_constructed_executor, times(1)).setThreadNamePrefix("LPVS-ASYNC::");
verify(mocked_constructed_executor, times(1)).setThreadNamePrefix("LPVS::");
verifyNoMoreInteractions(mocked_constructed_executor);
}
}
Expand Down

0 comments on commit 2d29e03

Please sign in to comment.