0
我們有一個Firebase功能,可以在24小時後刪除項目。該功能的作品,但是,鏈接到該功能的網頁保持運行,所以我猜這個功能是無止境的循環。有沒有辦法解決這個問題?雲端功能繼續運行
這是我們的功能:
exports.delete = functions.https.onRequest((req, res) => {
const currentTime = new Date().getTime();
const dayAgo = currentTime - 86400000;
ref.child('testlijst')
.orderByChild('tijd')
.endAt(dayAgo)
.once('value')
.then(snap => {
snap.forEach(c => {
c.ref.remove();
})
});
});