@@ -406,11 +406,9 @@ export class DatabaseTaskStore implements TaskStore {
|
||||
}[];
|
||||
}>;
|
||||
// (undocumented)
|
||||
recoverTasks(options: TaskStoreRecoverTaskOptions): Promise<
|
||||
{
|
||||
id: string;
|
||||
}[]
|
||||
>;
|
||||
recoverTasks(options: TaskStoreRecoverTaskOptions): Promise<{
|
||||
ids: string[];
|
||||
}>;
|
||||
// (undocumented)
|
||||
shutdownTask(options: TaskStoreShutDownTaskOptions): Promise<void>;
|
||||
}
|
||||
@@ -563,11 +561,9 @@ export interface TaskStore {
|
||||
}[];
|
||||
}>;
|
||||
// (undocumented)
|
||||
recoverTasks?(options: TaskStoreRecoverTaskOptions): Promise<
|
||||
{
|
||||
id: string;
|
||||
}[]
|
||||
>;
|
||||
recoverTasks?(options: TaskStoreRecoverTaskOptions): Promise<{
|
||||
ids: string[];
|
||||
}>;
|
||||
// (undocumented)
|
||||
shutdownTask?(options: TaskStoreShutDownTaskOptions): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -483,8 +483,8 @@ export class DatabaseTaskStore implements TaskStore {
|
||||
|
||||
async recoverTasks(
|
||||
options: TaskStoreRecoverTaskOptions,
|
||||
): Promise<{ id: string }[]> {
|
||||
const taskIdsToRecover: { id: string }[] = [];
|
||||
): Promise<{ ids: string[] }> {
|
||||
const taskIdsToRecover: string[] = [];
|
||||
const timeoutS = Duration.fromObject(options.timeout).as('seconds');
|
||||
|
||||
await this.db.transaction(async tx => {
|
||||
@@ -501,7 +501,7 @@ export class DatabaseTaskStore implements TaskStore {
|
||||
['id', 'spec'],
|
||||
);
|
||||
|
||||
taskIdsToRecover.push(...result.map(i => ({ id: i.id })));
|
||||
taskIdsToRecover.push(...result.map(i => i.id));
|
||||
|
||||
for (const { id, spec } of result) {
|
||||
const taskSpec = JSON.parse(spec as string) as TaskSpec;
|
||||
@@ -516,6 +516,6 @@ export class DatabaseTaskStore implements TaskStore {
|
||||
}
|
||||
});
|
||||
|
||||
return taskIdsToRecover;
|
||||
return { ids: taskIdsToRecover };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,10 +220,9 @@ export class StorageTaskBroker implements TaskBroker {
|
||||
'scaffolder.EXPERIMENTAL_recoverTasksTimeout',
|
||||
defaultTimeout,
|
||||
);
|
||||
const recoveredTaskIds =
|
||||
(await this.storage.recoverTasks?.({
|
||||
timeout,
|
||||
})) ?? [];
|
||||
const { ids: recoveredTaskIds } = (await this.storage.recoverTasks?.({
|
||||
timeout,
|
||||
})) ?? { ids: [] };
|
||||
if (recoveredTaskIds.length > 0) {
|
||||
this.signalDispatch();
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ export interface TaskStore {
|
||||
|
||||
recoverTasks?(
|
||||
options: TaskStoreRecoverTaskOptions,
|
||||
): Promise<{ id: string }[]>;
|
||||
): Promise<{ ids: string[] }>;
|
||||
|
||||
getTask(taskId: string): Promise<SerializedTask>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user