Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move the createAudioDb to be after the ingest process #641

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions noncore/_utils/rfcx-mqtt/mqtt-checkin-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ function onMessageCheckin (data, messageId) {
.then((checkInObj) => {
return checkInDatabase.syncGuardianPrefs(checkInObj)
})
.then((checkInObj) => {
return checkInDatabase.createDbAudio(checkInObj)
})
.then((checkInObj) => {
return checkInDatabase.createDbScreenShot(checkInObj)
})
Expand All @@ -65,6 +62,10 @@ function onMessageCheckin (data, messageId) {
}
return Promise.resolve(checkInObj)
})
// Create audio db after getting path from ingest
.then((checkInObj) => {
return checkInDatabase.createDbAudio(checkInObj)
})
.then((checkInObj) => {
return checkInDatabase.finalizeCheckIn(checkInObj)
})
Expand Down
2 changes: 1 addition & 1 deletion noncore/_utils/rfcx-mqtt/mqtt-database.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ exports.checkInDatabase = {
site_id: checkInObj.db.dbGuardian.site_id,
check_in_id: checkInObj.db.dbCheckIn.id,
sha1_checksum: checkInObj.audio.meta.sha1CheckSum,
url: null,
url: `s3://${checkInObj.audio.meta.ingestBucket}/${checkInObj.audio.meta.ingestPath}`,
encode_duration: checkInObj.audio.meta.encodeDuration,
measured_at: checkInObj.audio.meta.measuredAt,
measured_at_local: moment.tz(checkInObj.audio.meta.measuredAt, (checkInObj.db.dbSite.timezone || 'UTC')).format('YYYY-MM-DDTHH:mm:ss.SSS'),
Expand Down
2 changes: 2 additions & 0 deletions noncore/_utils/rfcx-mqtt/mqtt-streams.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ async function ingestGuardianAudio (checkInObj) {
targetBitrate: checkInObj.audio.meta.bitRate,
sampleRate: checkInObj.audio.meta.sampleRate
})
checkInObj.audio.meta.ingestPath = uploadData.path
checkInObj.audio.meta.ingestBucket = uploadData.bucket
await S3Service.putObject(checkInObj.audio.filePath, uploadData.path, uploadData.bucket)
assetUtils.deleteLocalFileFromFileSystem(checkInObj.audio.filePath)
return checkInObj
Expand Down
Loading