我有一个用 Java 编写的 AWS Lambda 函数。此函数启动 TranscriptionJob,然后等待响应,如下所示:
while( true ){
transcriptionJob = awsClient.getTranscriptionJob(getJobRequest).getTranscriptionJob();
if( transcriptionJob.getTranscriptionJobStatus().equals(TranscriptionJobStatus.COMPLETED.name()) ){
System.out.println("AWS transcribe completed with " + transcriptionJob.getMedia().getMediaFileUri());
Date comleption = transcriptionJob.getCompletionTime();
// duration until response in seconds
long duration = (comleption.getTime()-awsTranscribeStart.getTime())/1000;
logger.log("AWS transcribe took " + duration + " seconds\n");
break;
}else if( transcriptionJob.getTranscriptionJobStatus().equals(TranscriptionJobStatus.FAILED.name()) ){
System.out.println("AWS transcribe failed: " + transcriptionJob.getFailureReason());
break;
}
System.out.println("Waiting for response...");
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
对于我较长的音频文件,转录作业最多需要 10 分钟才能完成,但 Lambda 函数限制为 5 分钟。没有“转录作业完成事件”或类似的东西(还)。
是否有解决此问题的方法,还是我必须从 AWS Lambda 切换到其他东西?