return refresh keys if item is cached
Signed-off-by: Kiss Miklos <miklos@roadie.io>
This commit is contained in:
@@ -145,20 +145,22 @@ export class DefaultProcessingDatabase implements ProcessingDatabase {
|
||||
BATCH_SIZE,
|
||||
);
|
||||
|
||||
// Delete old refresh keys
|
||||
await tx<DbRefreshKeysRow>('refresh_keys')
|
||||
.where({ entity_id: id })
|
||||
.delete();
|
||||
if (refreshKeys && refreshKeys.length > 0) {
|
||||
// Delete old refresh keys
|
||||
await tx<DbRefreshKeysRow>('refresh_keys')
|
||||
.where({ entity_id: id })
|
||||
.delete();
|
||||
|
||||
// Insert the refresh keys for the processed entity
|
||||
await tx.batchInsert(
|
||||
'refresh_keys',
|
||||
refreshKeys.map(k => ({
|
||||
entity_id: id,
|
||||
key: k.key,
|
||||
})),
|
||||
BATCH_SIZE,
|
||||
);
|
||||
// Insert the refresh keys for the processed entity
|
||||
await tx.batchInsert(
|
||||
'refresh_keys',
|
||||
refreshKeys.map(k => ({
|
||||
entity_id: id,
|
||||
key: k.key,
|
||||
})),
|
||||
BATCH_SIZE,
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
previous: {
|
||||
|
||||
@@ -102,6 +102,7 @@ export class UrlReaderProcessor implements CatalogProcessor {
|
||||
for (const parseResult of cacheItem.value) {
|
||||
emit(parseResult);
|
||||
}
|
||||
emit(processingResult.refresh(`${location.type}:${location.target}`));
|
||||
} else if (error.name === 'NotFoundError') {
|
||||
if (!optional) {
|
||||
emit(processingResult.notFoundError(location, message));
|
||||
|
||||
Reference in New Issue
Block a user