Skip to content

Commit

Permalink
Assign default value to next run time if incorrect value to delay/sch…
Browse files Browse the repository at this point in the history
…edule is provided
  • Loading branch information
lovesh-ap committed Nov 18, 2024
1 parent 4b5b84c commit 4956365
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ private void readScanSchedule() throws RestrictionModeException {
} else {
throw new RestrictionModeException(INVALID_CRON_EXPRESSION_PROVIDED_FOR_IAST_RESTRICTED_MODE);
}
} else {
agentMode.getScanSchedule().setNextScanTime(new Date(Instant.now().toEpochMilli()));
}
agentMode.getScanSchedule().setDataCollectionTime(agentMode.getScanSchedule().getNextScanTime());
if(agentMode.getScanSchedule().isCollectSamples()){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public void startDataRequestSchedule(long delay, TimeUnit timeUnit){
} catch (Exception e) {
logger.log(LogLevel.WARNING, String.format("Error while reading Configuration security.scan_request_rate_limit : %s, Using default value %s replay request per min.", e.getMessage(), currentFetchThresholdPerMin), e, this.getClass().getName());
}
logger.log(LogLevel.INFO, String.format("IAST data pull request is scheduled at %s, after delay of %s seconds", AgentConfig.getInstance().getAgentMode().getScanSchedule().getDataCollectionTime(), initialDelay), IASTDataTransferRequestProcessor.class.getName());
logger.log(LogLevel.INFO, String.format("IAST data pull request is scheduled at %s", AgentConfig.getInstance().getAgentMode().getScanSchedule().getDataCollectionTime()), IASTDataTransferRequestProcessor.class.getName());
future = executorService.scheduleWithFixedDelay(this::task, initialDelay, delay, timeUnit);
} catch (Throwable ignored){}
}
Expand Down

0 comments on commit 4956365

Please sign in to comment.