[英]MongoDB Stitch trigger delay
Are there known delays with MongoDB Stitch triggers? MongoDB Stitch触发器是否存在已知的延迟? I see a 1-2 minute gap between authentication events and trigger completion.
我看到认证事件和触发器完成之间有1-2分钟的间隔。
I have a simple Authentication Trigger which executes on Create . 我有一个简单的身份验证触发器 ,该触发器在Create上执行。 In other words, the trigger fires when a new user is added.
换句话说,添加新用户时将触发触发器。
The trigger calls the function below to add the new user to a temporary collection. 触发器调用下面的函数将新用户添加到临时集合。
exports = async function(authEvent) {
const mongodb = context.services.get("mongodb-atlas");
const newUsers = mongodb.db("DATABASE").collection("newUsers");
const { user, time } = authEvent;
const newUser = { ...user, eventLog: [ { "created": time } ], access: [{"status": "pending"}] };
await newUsers.insertOne(newUser);
}
The results are shown below. 结果如下所示。 The authEvent records user creation time as 11:40 .
authEvent将用户创建时间记录为11:40 。 However, the new document isn't inserted until 11:42 .
但是,直到11:42才插入新文档。
What's the reason for the delay? 延迟的原因是什么?
Server Version: cloud-2.26.4UI Version: 3.25.3JS SDK Version: 3.4.0 Plan: M0 服务器版本:cloud-2.26.4UI版本:3.25.3JS SDK版本:3.4.0计划:M0
The cause of this delay was placement of the Atlas deployment in one region and the Stitch deployment in a different region . 延迟的原因是将Atlas部署放置在一个区域中 ,将Stitch部署放置在另一个区域中 。
According to the MongoDB docs : 根据MongoDB文档 :
Write operations to a linked MongoDB cluster are handled within a single region that you specify when you create your application .
创建链接的MongoDB集群的写操作在创建应用程序时指定的单个区域内处理。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.