Skip to content

Commit

Permalink
Add a maxInstances for th processCardEmbedding.
Browse files Browse the repository at this point in the history
Part of #646.
  • Loading branch information
jkomoros committed Oct 29, 2023
1 parent 695779b commit 6dee860
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ export const emailAdminOnMessage = functions.firestore.
document('messages/{messageId}').
onCreate(email.onMessage);

//TODO: only allow a single instance
export const updateCardEmbedding = functions.firestore.
export const updateCardEmbedding = functions.runWith({
//Since we'll hit the hnsw saving/restoring, and we should only have a
//very small number of concurrent editors, set to a max instance of one
//to make it less likely we have collisions.
maxInstances: 1
}).firestore.
document('cards/{cardID}').
onWrite(processCardEmbedding);

Expand Down

0 comments on commit 6dee860

Please sign in to comment.