+
stdout_1 <- tempfile()
stdout_2 <- tempfile()
rp <- callr::r_bg(worker, stdout = stdout_1, stderr = stdout_1)
@@ -256,7 +255,7 @@
Now our client can add some values to our table and notify the
workers that there’s something to do:
-
+
con <- dbConnect(RPostgres::Postgres())
add_sqroot <- function(in_val) {
@@ -269,31 +268,28 @@
-
-
-add_sqroot(9)
+#> [1] 0
+add_sqroot(8)
+#> [1] 0
+add_sqroot(9)
#> [1] 0
…after a wait, the answers should have been populated by the workers
for us:
-
+
Sys.sleep(3)
rs <- dbSendQuery(con, "SELECT * FROM sqroot_vignette_example ORDER BY in_val")
dbFetch(rs)
#> in_val out_val
#> 1 7 2.645751
#> 2 8 2.828427
-#> 3 9 3.000000
-
+#> 3 9 3.000000
+dbClearResult(rs) ; rs <- NULL
Finally, we can use NOTIFY
to stop all the workers:
-
+
dbExecute(con, "NOTIFY sqroot_shutdown, ''")
#> [1] 0
And see what messages were printed as they run:
-
+
# We can't control which worker will process the first entry,
# so we sort the results so the vignette output stays the same.
outputs <- sort(c(
@@ -304,9 +300,8 @@
-
-writeLines(outputs[[2]])
+#> Shutting down.
+writeLines(outputs[[2]])
#> Sqroot-ing 7 ...
#> Not sqroot-ing as another worker got there first
#> Sqroot-ing 9 ...
@@ -327,7 +322,7 @@ Implementing our worker
diff --git a/dev/authors.html b/dev/authors.html
index 01c0bf98..1273c39b 100644
--- a/dev/authors.html
+++ b/dev/authors.html
@@ -7,7 +7,7 @@
RPostgres
- 1.4.7.9003
+ 1.4.7.9004
@@ -90,7 +90,7 @@ Citation
diff --git a/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyC0ITw.woff2 b/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyC0ITw.woff2
index f4675de1..6478b9ad 100644
Binary files a/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyC0ITw.woff2 and b/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyC0ITw.woff2 differ
diff --git a/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCAIT5lu.woff2 b/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCAIT5lu.woff2
index 7ac6ae08..dee82d4b 100644
Binary files a/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCAIT5lu.woff2 and b/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCAIT5lu.woff2 differ
diff --git a/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCIIT5lu.woff2 b/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCIIT5lu.woff2
index 3d4f643a..b5664780 100644
Binary files a/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCIIT5lu.woff2 and b/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCIIT5lu.woff2 differ
diff --git a/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCMIT5lu.woff2 b/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCMIT5lu.woff2
index 753e47ca..e0d65386 100644
Binary files a/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCMIT5lu.woff2 and b/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCMIT5lu.woff2 differ
diff --git a/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCkIT5lu.woff2 b/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCkIT5lu.woff2
index 49dbbaa5..1005b7c8 100644
Binary files a/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCkIT5lu.woff2 and b/dev/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCkIT5lu.woff2 differ
diff --git a/dev/index.html b/dev/index.html
index fd03e0ed..8dcda941 100644
--- a/dev/index.html
+++ b/dev/index.html
@@ -23,7 +23,7 @@
RPostgres
- 1.4.7.9003
+ 1.4.7.9004
diff --git a/dev/news/index.html b/dev/news/index.html
index 8566fa20..7bcf7428 100644
--- a/dev/news/index.html
+++ b/dev/news/index.html
@@ -7,7 +7,7 @@
RPostgres
- 1.4.7.9003
+ 1.4.7.9004
+