Merge pull request #601 from storytold/fix/anon-job-polling-fix

fixed job polling being killed prematurely
This commit is contained in:
Victor O authored and GitHub committed 2024-07-08 15:53:00 -07:00
commit 94351678a6
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);
}
};