Purpose
This job limit the time of request being in status NEW. It changes status of person to preperson merge requests to EXPIRED after configured period of it existance.
Job logic
Job starts once in 24 hours by default (configured parameter PREPERSON_MERGE_REQUEST_SCHEDULE).
After starting it gets value from global parameter PREPERSON_MERGE_REQUEST_EXPIRATION.
Select all entries from il.merge_requests with status=NEW or APPROVED:
If inserted_at >= current_datetime() - PREPERSON_MERGE_REQUEST_EXPIRATION. Then skip the record
If inserted_at < current_datetime() - PREPERSON_MERGE_REQUEST_EXPIRATION. Then update entry:
set status = EXPIRED
set updated_at = current_datetime()
set updated_by = system_user()
for APPROVED preperson merge request anonymize person data