Skip to content

Commit

Permalink
add timeout when waiting for ipykernel init
Browse files Browse the repository at this point in the history
  • Loading branch information
t-kalinowski committed Oct 9, 2024
1 parent 128bd78 commit 145eb99
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/thread.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ py_run_file_on_thread <- function(file, ..., args = NULL) {
if (launching_lsp) {

PositronIPKernelApp <- import("positron_ipykernel.positron_ipkernel")$PositronIPKernelApp
while(!PositronIPKernelApp$initialized())
for(i in 1:40) { # Positron timeout is 20 seconds
if (PositronIPKernelApp$initialized()) break
Sys.sleep(.5)
}
Sys.sleep(1)

py_eval("__import__('__main__').__dict__.update", FALSE)(main_dict)
Expand Down

0 comments on commit 145eb99

Please sign in to comment.