summaryrefslogtreecommitdiff
path: root/lib/output/pq
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-07-05 21:21:20 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-07-05 21:21:20 +0100
commit8203366aa559e450db8b5bfe3e1f4e4bc690a304 (patch)
treec519fc0bc10455d2da26a84a4db396aabfc8f9ec /lib/output/pq
parentExplicit integer type casts (diff)
downloadmygrate-8203366aa559e450db8b5bfe3e1f4e4bc690a304.tar.bz2
mygrate-8203366aa559e450db8b5bfe3e1f4e4bc690a304.tar.xz
mygrate-8203366aa559e450db8b5bfe3e1f4e4bc690a304.zip
Simplify PQ upload lambda
Diffstat (limited to 'lib/output/pq')
-rw-r--r--lib/output/pq/pqConn.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/output/pq/pqConn.cpp b/lib/output/pq/pqConn.cpp
index d35d011..f4e5226 100644
--- a/lib/output/pq/pqConn.cpp
+++ b/lib/output/pq/pqConn.cpp
@@ -71,12 +71,8 @@ namespace MyGrate::Output::Pq {
return fopencookie(this, "w",
{nullptr,
[](void * cookie, const char * buf, size_t size) {
- auto pq = static_cast<PqConn *>(cookie);
- int rc;
- while (!(rc = PQputCopyData(pq->conn.get(), buf, (int)size))) {
- sleep(1);
- }
- verify<PqErr>(rc == 1, "copy data", pq->conn.get());
+ auto conn = static_cast<PqConn *>(cookie)->conn.get();
+ verify<PqErr>(PQputCopyData(conn, buf, (int)size) == 1, "copy data", conn);
return (ssize_t)size;
},
nullptr,