amazon-connect / amazon-connect-realtime-transcription

Transcribe Live Customer Audio for Amazon Connect using Amazon Kinesis Video Streams and Amazon Transcribe
MIT No Attribution
163 stars 99 forks source link

added code to delete raw files after uploading to S3 #59

Closed khastation closed 3 years ago

khastation commented 3 years ago

Issue #, if available:

Description of changes: This change adds code to clean up the /tmp folder in the KVSTranscribeStreamingLambda by removing raw audio files.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

ltr120 commented 3 years ago

Overall looks good if it is a sample only. For this change to be more “production ready”, I’d suggest to move the logger line to after deletion and include contactId with result of deletion as well.

        File fileToDelete = new File(kvsStreamTrackObject.getSaveAudioFilePath().toString());
        if (fileToDelete != null) {
            Boolean deletionResult = fileToDelete.delete();
            logger.info("Raw file for contactId {} deletion result: {}", contactId, deletionResult);
khastation commented 3 years ago

Overall looks good if it is a sample only. For this change to be more “production ready”, I’d suggest to move the logger line to after deletion and include contactId with result of deletion as well.

        File fileToDelete = new File(kvsStreamTrackObject.getSaveAudioFilePath().toString());
        if (fileToDelete != null) {
            Boolean deletionResult = fileToDelete.delete();
            logger.info("Raw file for contactId {} deletion result: {}", contactId, deletionResult);

Thanks! I've made these changes now.