Firebase - Cloud Firestore Trigger Idempotency

问题描述:

Cloud Firestore触发器的Firebase文档提到了此处的功能由Firestore数据库中的事件触发的应该是幂等的。

The Firebase docs for Cloud Firestore Triggers mentions here that functions triggered by an event from the Firestore database should be idempotent.

是否存在某种事件id 传递给由云触发的函数Firestore事件可用于识别某个函数是否在同一个Firestore事件中被执行多次(因此可以忽略对具有相同事件id 的函数的后续调用)?

Is there some kind of event id that is passed to the Cloud Function triggered by the Firestore event that could be used to identify whether or not a function is being executed more than once from the same Firestore event (and thus subsequent calls to the function with the same event id could be ignored)?

Cloud Functions中的每个事件都附带一个具有唯一 eventId 属性(该链接转到EventContext的API文档)。

Each event in Cloud Functions comes with a context that has a unique eventId property (the link goes to the API docs for EventContext).