fix: clear queue on cancelling jobs
This commit is contained in:
@@ -17,8 +17,9 @@ import { checkContainer, removeContainer } from './docker';
|
||||
import { day } from './dayjs';
|
||||
import * as serviceFields from './serviceFields'
|
||||
import { saveBuildLog } from './buildPacks/common';
|
||||
import { scheduler } from './scheduler';
|
||||
|
||||
export const version = '3.8.0';
|
||||
export const version = '3.8.1';
|
||||
export const isDev = process.env.NODE_ENV === 'development';
|
||||
|
||||
const algorithm = 'aes-256-ctr';
|
||||
@@ -1879,6 +1880,10 @@ export async function stopBuild(buildId, applicationId) {
|
||||
}
|
||||
if (count > 50) {
|
||||
clearInterval(interval);
|
||||
if (scheduler.workers.has('deployApplication')) {
|
||||
scheduler.workers.get('deployApplication').postMessage("action:flushQueue")
|
||||
}
|
||||
await cleanupDB(buildId);
|
||||
return reject(new Error('Build canceled'));
|
||||
}
|
||||
const { stdout: buildContainers } = await executeDockerCmd({ dockerId, command: `docker container ls --filter "label=coolify.buildId=${buildId}" --format '{{json .}}'` })
|
||||
@@ -1889,15 +1894,14 @@ export async function stopBuild(buildId, applicationId) {
|
||||
const id = containerObj.ID;
|
||||
if (!containerObj.Names.startsWith(`${applicationId} `)) {
|
||||
await removeContainer({ id, dockerId });
|
||||
|
||||
clearInterval(interval);
|
||||
return resolve();
|
||||
}
|
||||
}
|
||||
}
|
||||
count++;
|
||||
} catch (error) { } finally {
|
||||
await cleanupDB(buildId);
|
||||
}
|
||||
} catch (error) { }
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
@@ -1914,10 +1918,7 @@ export function convertTolOldVolumeNames(type) {
|
||||
return 'nc'
|
||||
}
|
||||
}
|
||||
// export async function getAvailableServices(): Promise<any> {
|
||||
// const { data } = await axios.get(`https://gist.githubusercontent.com/andrasbacsai/4aac36d8d6214dbfc34fa78110554a50/raw/5b27e6c37d78aaeedc1148d797112c827a2f43cf/availableServices.json`)
|
||||
// return data
|
||||
//
|
||||
|
||||
export async function cleanupDockerStorage(dockerId, lowDiskSpace, force) {
|
||||
// Cleanup old coolify images
|
||||
try {
|
||||
|
Reference in New Issue
Block a user