-
Couldn't load subscription status.
- Fork 16
Open
Labels
Description
Lines 286 to 320 in 2139b03
| await this.lockOperation(() => | |
| pMap( | |
| this.localGraphObjectStore.collectRelationshipsByStep(), | |
| async ([stepId, relationships]) => { | |
| const indexable = relationships.filter((r) => { | |
| const indexMetadata = this.getIndexMetadataForGraphObjectType({ | |
| stepId, | |
| _type: r._type, | |
| graphObjectCollectionType: 'relationships', | |
| }); | |
| if (typeof indexMetadata === 'undefined') { | |
| return true; | |
| } | |
| return indexMetadata.enabled === true; | |
| }); | |
| if (indexable.length) { | |
| await flushDataToDisk({ | |
| storageDirectoryPath: stepId, | |
| collectionType: 'relationships', | |
| data: indexable, | |
| pretty: this.prettifyFiles, | |
| }); | |
| } | |
| this.localGraphObjectStore.flushRelationships(relationships); | |
| if (onRelationshipsFlushed) { | |
| await onRelationshipsFlushed(relationships); | |
| } | |
| }, | |
| ), | |
| ); |
Does the onRelationshipsFlushed hook also need to be locked in the code above? My impression is that after the relationships/entities have been flushed, the hook should be free to run concurrently. If separately a step is running and able to fill the buffer, it must wait until the onRelationshipsFlushed/onEntitiesFlushed hook has finished. If the hook is an upload, that may unnecessarily slow down filling up and flushing the buffer again while uploads are happening. The hook seems like it might be unnecessarily blocking.