Created
November 1, 2017 20:57
-
-
Save avivl/c16af302a09a338f41480a11689a10d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.DeleteRunningJobFromFinished = functions.database.ref('finished-jobs/{key}').onCreate(event => | |
{ | |
const runningRef = event.data.adminRef.root.child('running-jobs') | |
const jobId = event.data.val()['protoPayload']['serviceData']['jobCompletedEvent']['job']['jobName']['jobId'] | |
runningRef.orderByChild('protoPayload/serviceData/jobInsertResponse/resource/jobName/jobId') | |
.equalTo(jobId).once("value", function (snapshot) { | |
snapshot.forEach(function (data) { | |
runningRef.child(data.key).remove() | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment