refactor(storage-fs): yield one migration entry at a time
This commit is contained in:
parent
d8a6a2428a
commit
59a013b0d8
1 changed files with 8 additions and 6 deletions
|
|
@ -113,12 +113,14 @@ export default function storageFs({ filename }: StorageFsOptions): EmigrateStora
|
||||||
async *getHistory() {
|
async *getHistory() {
|
||||||
const history = await read();
|
const history = await read();
|
||||||
|
|
||||||
yield* Object.entries(history).map(([name, { status, date, error }]) => ({
|
for (const [name, { status, date, error }] of Object.entries(history)) {
|
||||||
name,
|
yield {
|
||||||
status,
|
name,
|
||||||
error,
|
status,
|
||||||
date: new Date(date),
|
date: new Date(date),
|
||||||
}));
|
error: error ? new Error(error.message) : undefined,
|
||||||
|
};
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async onSuccess(migration) {
|
async onSuccess(migration) {
|
||||||
await update(migration.name, 'done');
|
await update(migration.name, 'done');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue