fixed job polling being killed prematurely

This commit is contained in:
Victor committed 2024-07-08 15:50:25 -07:00
1 parent 402a1603f0
commit 8e8a4dd45a
1 file changed
+5 -2
@@ -76,7 +76,7 @@ export default function useInferenceJobsPolling({
const [keepAlive, keepAliveSet] = useState(!!user);
// if this interval value is state set by the server response, useInterval will adjust accordingly
const interval = 2500;
const interval = 1500;
// this is to acccomodate async session loading
useEffect(() => {
@@ -105,7 +105,10 @@ export default function useInferenceJobsPolling({
) => {
inferenceJobsSet(updatedJobs);
byCategorySet(categoryMap);
if (!updatedJobs.some(job => jobStateCanChange(job.jobState))) {
if (
updatedJobs.length &&
!updatedJobs.some(job => jobStateCanChange(job.jobState))
) {
keepAliveSet(false);
}
};