firebase的云功能已完成,状态:';超时';

firebase的云功能已完成,状态:';超时';,firebase,firebase-realtime-database,google-cloud-functions,Firebase,Firebase Realtime Database,Google Cloud Functions,函数执行时没有错误。我得到了这个地位 函数执行耗时60004毫秒,状态为“超时” 我不确定是什么问题。我所有的功能对我来说都很好。我还注意到函数有时需要几秒钟来更新数据库,有时会立即更新。执行时间从瞬间变为几秒钟是正常的吗?执行时间应该是即时的吗 exports.countproposals = functions.database.ref("/proposals/{jobid}/{propid}").onWrite((event) => { const jobid = event

函数执行时没有错误。我得到了这个地位

函数执行耗时60004毫秒,状态为“超时”

我不确定是什么问题。我所有的功能对我来说都很好。我还注意到函数有时需要几秒钟来更新数据库,有时会立即更新。执行时间从瞬间变为几秒钟是正常的吗?执行时间应该是即时的吗

exports.countproposals = functions.database.ref("/proposals/{jobid}/{propid}").onWrite((event) => {
    const jobid = event.params.jobid;
    const userId = event.params.propid;
    const userRef = admin.database().ref(`users/${userId}/proposals/sent`);
    if (event.data.exists() && !event.data.previous.exists()) {
        userRef.child(jobid).set({
            timestamp: admin.database.ServerValue.TIMESTAMP
        });
    } else if (!event.data.exists() && event.data.previous.exists()) {
        userRef.child(jobid).remove();
    }
    const collectionRef = admin.database().ref(`/jobs/${jobid}`);
    const countRef = collectionRef.child("proposals");
    return countRef.transaction(current => {
        if (event.data.exists() && !event.data.previous.exists()) {
            return (current || 0) + 1;
        } else if (!event.data.exists() && event.data.previous.exists()) {
            return (current || 0) - 1;
        }
    });
});

根据我的经验,我想这(希望)是firebase函数本身的一个暂时问题。
我收到的警告/错误与昨天平均执行时间约为200毫秒的函数相同。

请记住,Firebase的云函数目前正处于测试阶段。该队仍在熨平一些粗糙的边缘。当产品退出测试版时,应该有更好的性能保证。这里也是一样,除了功能似乎正在重新启动。。就像在一个无限循环中一样,我的日志正在堆积(我的情况是有一个错误),你是用实时的还是本地的emulator运行这个?