Firebase 的云功能已完成,状态为:'timeout'

Cloud functions for firebase finished with status: 'timeout'

函数执行无误。我正在获取状态

Function execution took 60004 ms, finished with status: 'timeout'

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

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 毫秒的函数,我得到了相同的 warnings/error。