Closed MertCingoz closed 1 year ago
I noticed a few things while looking at this. We already have these properties:
# Defaults for temporary resource lifetime (Can override via endpoint parameters if supplied)
# Default time before the resource is removed after completion
#rest.temporaryResource.expirationPeriods=1
#rest.temporaryResource.expirationPeriodType=HOURS
# Default time that the task is allowed to run for before it is cancelled
#rest.temporaryResource.timeoutPeriods=3
#rest.temporaryResource.timeoutPeriodType=HOURS
which are used for the other temporary resource container. So it got me thinking that we should probably have something configurable for this. My thoughts are along these lines:
# Defaults for System Action task and resource lifetime (Can override via endpoint parameter if supplied)
# Default time before the resource is removed after completion
#rest.systemAction.expirationPeriods=1
#rest.systemAction.expirationPeriodType=WEEKS
And then modifying the REST controller:
private long defaultResourceTimeout;
public SystemActionRestController(@Value("${rest.systemAction.expirationPeriodType:WEEKS}") int expirationPeriodType,
@Value("${rest.systemAction.expirationPeriods:1}") int expirationPeriods){
this.resources = new MangoRestTemporaryResourceContainer<>("SYSACTION_");
this.defaultResourceTimeout = Common.getMillis(
Common.TIME_PERIOD_CODES.getId(expirationPeriodType), expirationPeriods);
}
So that you can use that default if none is supplied to the endpoint. Note that you will have to change the endpoint to allow a null value by removing the default from the annotation.
Description
Backported changes for https://github.com/RadixIoT/mango/pull/161