Sync log-writer for all commands
authorSiraaj Khandkar <siraaj@khandkar.net>
Tue, 23 Mar 2021 14:15:38 +0000 (10:15 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Tue, 23 Mar 2021 14:15:38 +0000 (10:15 -0400)
not just download.

tt.rkt

diff --git a/tt.rkt b/tt.rkt
index 1cb90cf..5db66ea 100644 (file)
--- a/tt.rkt
+++ b/tt.rkt
   (log-message (current-logger) 'fatal 'stop "Exiting." #f)
   (thread-wait log-writer))
 
-(: logger-start (-> Log-Level Thread))
-(define (logger-start level)
+(: log-writer-start (-> Log-Level Thread))
+(define (log-writer-start level)
   (let* ([logger
            (make-logger #f #f level #f)]
          [log-receiver
       "u, upload   : Upload your twtxt file (alias to execute ~/.tt/upload)."
       ""
       #:args (command . args)
-      (define log-writer (logger-start log-level))
+      (define log-writer (log-writer-start log-level))
       (current-command-line-arguments (list->vector args))
       (match command
         [(or "d" "download")
              #:args (filename)
              (define-values (_res _cpu real-ms _gc)
                (time-apply timeline-download (list num-workers (file->peers filename))))
-             (log-info "Timeline downloaded in ~a seconds." (/ real-ms 1000.0))
-             (log-writer-stop log-writer)))]
+             (log-info "Timeline downloaded in ~a seconds." (/ real-ms 1000.0))))]
         [(or "u" "upload")
          (command-line
            #:program
               "Long output format"
               (set! out-format 'multi-line)]
              #:args (filename)
-             (timeline-print out-format (timeline-read order (file->peers filename)))))]
-        ))))
+             (timeline-print out-format (timeline-read order (file->peers filename)))))])
+      (log-writer-stop log-writer))))
This page took 0.030089 seconds and 4 git commands to generate.