Skip to content

Commit cb39398

Browse files
committed
chore: skip unchanged docs
1 parent b9d784d commit cb39398

File tree

1 file changed

+7
-2
lines changed
  • extensions/firestore-huggingface-inference-api/functions/src

1 file changed

+7
-2
lines changed

extensions/firestore-huggingface-inference-api/functions/src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import * as functions from 'firebase-functions';
33
import config from './config';
44

55
import {
6-
InferenceOutputError,
7-
HfInferenceEndpoint,
86
HfInference,
7+
HfInferenceEndpoint,
8+
InferenceOutputError,
99
} from '@huggingface/inference';
1010
import { runInference } from './inference';
1111

@@ -21,6 +21,11 @@ export const triggerInference = functions.firestore
2121
return;
2222
}
2323

24+
if (snapshot.after.isEqual(snapshot.before)) {
25+
functions.logger.info('Document have not changed, skipping inference');
26+
return;
27+
}
28+
2429
let inference: HfInference | HfInferenceEndpoint;
2530

2631
if (config.inferenceEndpoint) {

0 commit comments

Comments
 (0)