File tree Expand file tree Collapse file tree 6 files changed +79
-7
lines changed
expected_failures/exercise_timeout Expand file tree Collapse file tree 6 files changed +79
-7
lines changed Original file line number Diff line number Diff line change
1
+ # Copyright 2024 Deepgram SDK contributors. All Rights Reserved.
2
+ # Use of this source code is governed by a MIT license that can be found in the LICENSE file.
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ import asyncio
6
+ import time
7
+ import logging , verboselogs
8
+
9
+ from deepgram import DeepgramClient , DeepgramClientOptions , LiveOptions
10
+
11
+
12
+ async def main ():
13
+ # for debugging
14
+ config : DeepgramClientOptions = DeepgramClientOptions (
15
+ verbose = logging .DEBUG , options = {"keepalive" : "true" }
16
+ )
17
+ deepgram : DeepgramClient = DeepgramClient ("" , config )
18
+
19
+ deepgram_connection = deepgram .listen .asynclive .v ("1" )
20
+
21
+ await deepgram_connection .start (LiveOptions ())
22
+
23
+ # Wait for a while to simulate a long-running connection
24
+ await asyncio .sleep (600 )
25
+
26
+ print ("deadlock!" )
27
+ try :
28
+ await deepgram_connection .finish ()
29
+ finally :
30
+ print ("no deadlock..." )
31
+
32
+
33
+ asyncio .run (main ())
Original file line number Diff line number Diff line change
1
+ # Copyright 2024 Deepgram SDK contributors. All Rights Reserved.
2
+ # Use of this source code is governed by a MIT license that can be found in the LICENSE file.
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ import time
6
+ import logging , verboselogs
7
+
8
+ from deepgram import DeepgramClient , DeepgramClientOptions , LiveOptions
9
+
10
+
11
+ def main ():
12
+ # for debugging
13
+ config : DeepgramClientOptions = DeepgramClientOptions (
14
+ verbose = logging .DEBUG , options = {"keepalive" : "true" }
15
+ )
16
+ deepgram : DeepgramClient = DeepgramClient ("" , config )
17
+ # OR
18
+ # deepgram: DeepgramClient = DeepgramClient()
19
+
20
+ deepgram_connection = deepgram .listen .live .v ("1" )
21
+
22
+ deepgram_connection .start (LiveOptions ())
23
+
24
+ # press any key to exit
25
+ input ("\n \n Press Enter to exit...\n \n " )
26
+
27
+ print ("deadlock!" )
28
+ try :
29
+ deepgram_connection .finish ()
30
+ finally :
31
+ print ("no deadlock..." )
32
+
33
+
34
+ if __name__ == "__main__" :
35
+ main ()
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 10
10
11
11
12
12
async def main ():
13
+ # for debugging
13
14
config : DeepgramClientOptions = DeepgramClientOptions (verbose = logging .DEBUG )
14
15
deepgram : DeepgramClient = DeepgramClient ("" , config )
16
+ # OR
17
+ # deepgram: DeepgramClient = DeepgramClient()
15
18
16
19
deepgram_connection = deepgram .listen .asynclive .v ("1" )
17
20
18
21
await deepgram_connection .start (LiveOptions ())
19
22
20
- time .sleep (
21
- 30
22
- ) # Deepgram will close the connection after 10-15s of silence, followed with another 5 seconds for a ping
23
+ # Deepgram will close the connection after 10-15s of silence, followed with another 5 seconds for a ping
24
+ await asyncio .sleep (30 )
23
25
24
26
print ("deadlock!" )
25
27
try :
Original file line number Diff line number Diff line change 9
9
10
10
11
11
def main ():
12
- config : DeepgramClientOptions = DeepgramClientOptions (verbose = logging .DEBUG )
12
+ # for debugging
13
+ config : DeepgramClientOptions = DeepgramClientOptions (verbose = logging .SPAM )
13
14
deepgram : DeepgramClient = DeepgramClient ("" , config )
15
+ # OR
16
+ # deepgram: DeepgramClient = DeepgramClient()
14
17
15
18
deepgram_connection = deepgram .listen .live .v ("1" )
16
19
17
20
deepgram_connection .start (LiveOptions ())
18
21
19
- time .sleep (
20
- 30
21
- ) # Deepgram will close the connection after 10-15s of silence, followed with another 5 seconds for a ping
22
+ # Deepgram will close the connection after 10-15s of silence, followed with another 5 seconds for a ping
23
+ time .sleep (30 )
22
24
23
25
print ("deadlock!" )
24
26
try :
You can’t perform that action at this time.
0 commit comments