Return HTTP response early on recorder split
The split function tends to time out. (The audio split/encode still works in this case, though.)
It's useful to only respond after the encoding is done/successful, but the recordings are pretty long (30 minutes) and often don't finish encoding to MP3 before the HTTP request times out.
Idea
-
Return code
200
(success) immediately on split request. (Actual JSON structure for a "success" response TBD later.) -
Call webhook when encoding is done.
Debug output
*** 1528099200.132149000 31000 123145307209728 open_auth_file:7820: fopen(/.htpasswd): No such file or directory
Recorder [recorder-1] opened file for recording: /Users/librarian/Desktop/Archives/Recorder/recordings/2018-06-04_01-00-00.mp3
format = MP3 file192 Kb/s CBR
/Users/librarian/Desktop/Archives/Recorder/lame --quiet --cbr -b 192 /Users/librarian/Library/Caches/AudioServer/temp_a3c0ca3e.wav /Users/librarian/Library/Caches/AudioServer/temp_e859272.mp3
Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSUnderlyingError=0x7fc50ba01d80 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=http://localhost:1234/instances/station-1/outputs/recorder-1, NSErrorFailingURLKey=http://localhost:1234/instances/station-1/outputs/recorder-1, _kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4, NSLocalizedDescription=The request timed out.}}, NSErrorFailingURLStringKey=http://localhost:1234/instances/station-1/outputs/recorder-1, NSErrorFailingURLKey=http://localhost:1234/instances/station-1/outputs/recorder-1, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=The request timed out.}
JUCE Assertion failure in WebServer.h:50
event failed; status code = 0
*** 1528099278.867946000 78735797000 123145307209728 process_new_connection:17063: handle_request done
*** 1528099278.867980000 34000 123145307209728 process_new_connection:17129: Done processing connection from 127.0.0.1 (78.000000 sec)
*** 1528099278.868010000 30000 123145307209728 worker_thread_run:17395: Connection closed
*** 1528099278.868015000 5000 123145307209728 consume_socket:17166: going idle
triggering event: split-recording-1
*** 1528101000.243674000 1721375659000 123145306673152 accept_new_connection:17470: Accepted socket 13
*** 1528101000.243712000 38000 123145307209728 consume_socket:17170: grabbed socket 13, going busy
*** 1528101000.243730000 18000 123145307209728 worker_thread_run:17352: Start processing connection from 127.0.0.1
*** 1528101000.243735000 5000 123145307209728 process_new_connection:16970: Start processing connection from 127.0.0.1
*** 1528101000.243739000 4000 123145307209728 process_new_connection:16977: calling get_request (1 times for this connection)
*** 1528101000.244321000 582000 123145307209728 alloc_get_host:12660: HTTP Host: localhost
*** 1528101000.244337000 16000 123145307209728 process_new_connection:17043: http: 1.1, error: none
*** 1528101000.244344000 7000 123145307209728 handle_request:13243: URL: /instances/station-1/outputs/recorder-1
*** 1528101000.244362000 18000 123145307209728 open_auth_file:7820: fopen(/.htpasswd): No such file or directory
Recorder [recorder-1] opened file for recording: /Users/librarian/Desktop/Archives/Recorder/recordings/2018-06-04_01-30-00.mp3
format = MP3 file192 Kb/s CBR
/Users/librarian/Desktop/Archives/Recorder/lame --quiet --cbr -b 192 /Users/librarian/Library/Caches/AudioServer/temp_af2180b0.wav /Users/librarian/Library/Caches/AudioServer/temp_ffad828c.mp3
Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSUnderlyingError=0x7fc509f1c930 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=http://localhost:1234/instances/station-1/outputs/recorder-1, NSErrorFailingURLKey=http://localhost:1234/instances/station-1/outputs/recorder-1, _kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4, NSLocalizedDescription=The request timed out.}}, NSErrorFailingURLStringKey=http://localhost:1234/instances/station-1/outputs/recorder-1, NSErrorFailingURLKey=http://localhost:1234/instances/station-1/outputs/recorder-1, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=The request timed out.}
JUCE Assertion failure in WebServer.h:50
event failed; status code = 0
*** 1528101080.083867000 79839505000 123145307209728 process_new_connection:17063: handle_request done
*** 1528101080.083901000 34000 123145307209728 process_new_connection:17129: Done processing connection from 127.0.0.1 (80.000000 sec)
*** 1528101080.083929000 28000 123145307209728 worker_thread_run:17395: Connection closed
*** 1528101080.083933000 4000 123145307209728 consume_socket:17166: going idle