add refresh to connection
Signed-off-by: Kiss Miklos <miklos@roadie.io>
This commit is contained in:
@@ -157,6 +157,14 @@ export interface ProcessingDatabase {
|
||||
*/
|
||||
refresh(txOpaque: Transaction, options: RefreshOptions): Promise<void>;
|
||||
|
||||
/**
|
||||
* Schedules a refresh for every entity that has a matching set of refresh key stored for it.
|
||||
*/
|
||||
refreshByRefreshKeys(
|
||||
txOpaque: Transaction,
|
||||
options: RefreshByKeyOptions,
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
* Lists all ancestors of a given entityRef.
|
||||
*
|
||||
|
||||
@@ -61,6 +61,16 @@ class Connection implements EntityProviderConnection {
|
||||
}
|
||||
}
|
||||
|
||||
async refresh(keys: string[]): Promise<void> {
|
||||
const db = this.config.processingDatabase;
|
||||
|
||||
await db.transaction(async (tx: any) => {
|
||||
return db.refreshByRefreshKeys(tx, {
|
||||
keys,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private check(entities: Entity[]) {
|
||||
for (const entity of entities) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user