Skip to content

Commit 70692c2

Browse files
committed
fix(sess): handle partial conn_write for large IPC payloads
1 parent b62c979 commit 70692c2

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

sess/R/dispatch.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ ipc_write <- function(data) {
77
line <- paste0(jsonlite::toJSON(data, auto_unbox = TRUE, null = "null", force = TRUE), "\n")
88
tryCatch(
99
{
10-
processx::conn_write(con, line)
10+
remainder <- processx::conn_write(con, line)
11+
12+
# processx::conn_write() may perform a partial write and return
13+
# remaining bytes; keep writing until all data is flushed.
14+
while (is.raw(remainder) && length(remainder) > 0) {
15+
remainder <- processx::conn_write(con, remainder)
16+
}
17+
1118
invisible(TRUE)
1219
},
1320
error = function(e) {

0 commit comments

Comments
 (0)