mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
Merge pull request #83 from Kingsrook/feature/CE-978-crashing-nodes
CE-978 - Moving from 6 hours to 5 hours for clean hours in addition t…
This commit is contained in:
@ -31,6 +31,7 @@ import java.io.Serializable;
|
||||
*******************************************************************************/
|
||||
public class AsyncJobStatus implements Serializable
|
||||
{
|
||||
private String jobName;
|
||||
private AsyncJobState state;
|
||||
private String message;
|
||||
private Integer current;
|
||||
@ -187,4 +188,36 @@ public class AsyncJobStatus implements Serializable
|
||||
{
|
||||
this.cancelRequested = cancelRequested;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for jobName
|
||||
*******************************************************************************/
|
||||
public String getJobName()
|
||||
{
|
||||
return (this.jobName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for jobName
|
||||
*******************************************************************************/
|
||||
public void setJobName(String jobName)
|
||||
{
|
||||
this.jobName = jobName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for jobName
|
||||
*******************************************************************************/
|
||||
public AsyncJobStatus withJobName(String jobName)
|
||||
{
|
||||
this.jobName = jobName;
|
||||
return (this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* QQQ - Low-code Application Framework for Engineers.
|
||||
* Copyright (C) 2021-2024. Kingsrook, LLC
|
||||
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
||||
* contact@kingsrook.com
|
||||
* https://github.com/Kingsrook/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.kingsrook.qqq.backend.core.actions.async;
|
||||
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** subclass designed to be used when we want there to be an instance (so code
|
||||
** doesn't have to all be null-tolerant), but there's no one who will ever be
|
||||
** reading the status data, so we don't need to store the object in a
|
||||
** state provider.
|
||||
*******************************************************************************/
|
||||
public class NonPersistedAsyncJobCallback extends AsyncJobCallback
|
||||
{
|
||||
private final AsyncJobStatus asyncJobStatus;
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public NonPersistedAsyncJobCallback(UUID jobUUID, AsyncJobStatus asyncJobStatus)
|
||||
{
|
||||
super(jobUUID, asyncJobStatus);
|
||||
this.asyncJobStatus = asyncJobStatus;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
protected void storeUpdatedStatus()
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
// noop - cf. base class, which writes to persistence here (our point is, we do not) //
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
}
|
@ -26,6 +26,7 @@ import java.util.UUID;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.kingsrook.qqq.backend.core.actions.async.AsyncJobCallback;
|
||||
import com.kingsrook.qqq.backend.core.actions.async.AsyncJobStatus;
|
||||
import com.kingsrook.qqq.backend.core.actions.async.NonPersistedAsyncJobCallback;
|
||||
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QInstanceValidationException;
|
||||
import com.kingsrook.qqq.backend.core.instances.QInstanceValidator;
|
||||
@ -139,7 +140,7 @@ public class AbstractActionInput
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// don't return null here (too easy to NPE). instead, if someone wants one of these, create one and give it to them. //
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
asyncJobCallback = new AsyncJobCallback(UUID.randomUUID(), new AsyncJobStatus());
|
||||
asyncJobCallback = new NonPersistedAsyncJobCallback(UUID.randomUUID(), new AsyncJobStatus().withJobName(getClass().getSimpleName()));
|
||||
}
|
||||
return asyncJobCallback;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import com.kingsrook.qqq.backend.core.actions.async.AsyncJobCallback;
|
||||
import com.kingsrook.qqq.backend.core.actions.async.AsyncJobStatus;
|
||||
import com.kingsrook.qqq.backend.core.actions.async.NonPersistedAsyncJobCallback;
|
||||
import com.kingsrook.qqq.backend.core.actions.processes.QProcessCallback;
|
||||
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.AbstractActionInput;
|
||||
@ -450,7 +451,7 @@ public class RunBackendStepInput extends AbstractActionInput
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// avoid NPE in case we didn't have one of these! create a new one... //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
asyncJobCallback = new AsyncJobCallback(UUID.randomUUID(), new AsyncJobStatus());
|
||||
asyncJobCallback = new NonPersistedAsyncJobCallback(UUID.randomUUID(), new AsyncJobStatus().withJobName(processName + "." + stepName));
|
||||
}
|
||||
return (asyncJobCallback);
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ public class InMemoryStateProvider implements StateProviderInterface
|
||||
|
||||
private final Map<AbstractStateKey, Object> map;
|
||||
|
||||
private static int jobPeriodSeconds = 60 * 60; // 1 hour
|
||||
private static int cleanHours = 6;
|
||||
private static int jobPeriodSeconds = 60 * 30; // 30 minutes
|
||||
private static int cleanHours = 5;
|
||||
private static int jobInitialDelay = 60 * 60 * cleanHours;
|
||||
|
||||
|
||||
@ -151,6 +151,18 @@ public class InMemoryStateProvider implements StateProviderInterface
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Get the current status
|
||||
*
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
public String status()
|
||||
{
|
||||
return ("InMemoryStateProvider map size: " + map.size());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Clean entries that started before the given Instant
|
||||
*
|
||||
|
@ -59,6 +59,11 @@ public interface StateProviderInterface
|
||||
*******************************************************************************/
|
||||
void remove(AbstractStateKey key);
|
||||
|
||||
/*******************************************************************************
|
||||
** Get the current status
|
||||
*******************************************************************************/
|
||||
String status();
|
||||
|
||||
/*******************************************************************************
|
||||
** Clean entries that started before the given Instant
|
||||
*******************************************************************************/
|
||||
|
@ -128,6 +128,18 @@ public class TempFileStateProvider implements StateProviderInterface
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Get the current status
|
||||
*
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
public String status()
|
||||
{
|
||||
return ("TempFileStateProvider status not supported");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Clean entries that started before the given Instant
|
||||
*******************************************************************************/
|
||||
|
Reference in New Issue
Block a user