From 8203366aa559e450db8b5bfe3e1f4e4bc690a304 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 5 Jul 2021 21:21:20 +0100 Subject: Simplify PQ upload lambda --- lib/output/pq/pqConn.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'lib') 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(cookie); - int rc; - while (!(rc = PQputCopyData(pq->conn.get(), buf, (int)size))) { - sleep(1); - } - verify(rc == 1, "copy data", pq->conn.get()); + auto conn = static_cast(cookie)->conn.get(); + verify(PQputCopyData(conn, buf, (int)size) == 1, "copy data", conn); return (ssize_t)size; }, nullptr, -- cgit v1.2.3