Issue
The Job Scheduler log status remains stuck in "In Progress" after a server outage during a triggered job and can not be deleted.
Environment
- Liferay DXP 7.4
- Quarterly Release 2023.Q3
Resolution
To address the issue of the Job Scheduler log being stuck in "In Progress" status follow these steps:
1. Utilize the provided Groovy script to change the status of the DispatchLog entry:
import com.liferay.dispatch.model.DispatchLog;
import com.liferay.dispatch.service.DispatchLogLocalServiceUtil;
DispatchLog dispatch = DispatchLogLocalServiceUtil.getDispatchLog(${dispatcherLogId})
dispatch.setStatus(4) //Status error
com.liferay.dispatch.service.DispatchLogLocalServiceUtil.updateDispatchLog(dispatch)
Ensure you replace ${dispatcherLogId} with the appropriate value. This ID can be obtained via one of two options:
-
Option 1: Extract it from the URL by clicking on the "In Progress" job and Look for
_com_liferay_dispatch_web_internal_portlet_DispatchPortlet_dispatchLogId=33701&_com_liferay_dispatch_web_internal_portlet_DispatchPortlet_dispatchTriggerId=3362
in the URL.
-
Option 2: Query the dispatcherlog table where the status is pending:
SELECT * FROM dispatchlog WHERE status = 1 AND endDate IS NULL;
2. After updating, you can choose to either delete it or retain it with the correct status
Additional Information