mirror of
https://github.com/dimitri/pgloader.git
synced 2026-01-31 03:51:04 +01:00
Fix with-monitor support of :start-logger option.
It used to still launch an extra set of threads for monitoring where, and that would confuse CCL where it's not possible to write into a stream from more than one thread concurrently.
This commit is contained in:
parent
0f62751a3f
commit
40128dbd75
@ -64,12 +64,16 @@
|
||||
(defmacro with-monitor ((&key (start-logger t)) &body body)
|
||||
"Start and stop the monitor around BODY code. The monitor is responsible
|
||||
for processing logs into a central logfile"
|
||||
`(let* ((*monitoring-queue* (lq:make-queue))
|
||||
(*monitoring-channel* (start-monitor :start-logger ,start-logger)))
|
||||
(unwind-protect
|
||||
,@body
|
||||
(stop-monitor :channel *monitoring-channel*
|
||||
:stop-logger ,start-logger))))
|
||||
`(if ,start-logger
|
||||
(let* ((*monitoring-queue* (lq:make-queue))
|
||||
(*monitoring-channel* (start-monitor :start-logger ,start-logger)))
|
||||
(unwind-protect
|
||||
,@body
|
||||
(stop-monitor :channel *monitoring-channel*
|
||||
:stop-logger ,start-logger)))
|
||||
|
||||
;; logger has already been started
|
||||
(progn ,@body)))
|
||||
|
||||
(defun monitor (queue)
|
||||
"Receives and process messages from *monitoring-queue*."
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user