File tree Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Original file line number Diff line number Diff line change 550
550
(while (.get ref)
551
551
(when-let [q (.get ref)]
552
552
(try
553
- (let [start (System/currentTimeMillis )]
553
+ (let [start (System/nanoTime )]
554
554
(fsync q)
555
- (let [end (System/currentTimeMillis )]
556
- (Thread/sleep (long (max 0 (- fsync-interval (- end start)))))))
555
+ (let [end (System/nanoTime )]
556
+ (Thread/sleep (long (max 0 (- ( * 1000000 fsync-interval) (- end start)))))))
557
557
(catch Throwable _)))))))
558
558
559
559
; ; populate queues with pre-existing tasks
746
746
" Returns a lazy sequence of tasks that can be consumed in `interval` milliseconds. This will
747
747
terminate after that time has elapsed, even if there are still tasks immediately available."
748
748
[qs q-name interval]
749
- (let [now (System/currentTimeMillis )]
749
+ (let [now (System/nanoTime )]
750
750
(lazy-seq
751
- (let [now' (System/currentTimeMillis )
752
- remaining (- interval (- now' now))]
751
+ (let [now' (System/nanoTime )
752
+ remaining (- ( * 1000000 interval) (- now' now))]
753
753
(when (pos? remaining)
754
754
(let [task (take! qs q-name remaining ::none )]
755
755
(when-not (= ::none task)
756
756
(cons
757
757
task
758
- (interval-task-seq qs q-name (- interval (- (System/currentTimeMillis ) now)))))))))))
758
+ (interval-task-seq qs q-name (- ( * 1000000 interval) (- (System/nanoTime ) now)))))))))))
759
759
760
760
(defn complete!
761
761
" Marks a task as complete."
Original file line number Diff line number Diff line change 551
551
(while (.get ref)
552
552
(when-let [q (.get ref)]
553
553
(try
554
- (let [start (System/currentTimeMillis )]
554
+ (let [start (System/nanoTime )]
555
555
(fsync q)
556
- (let [end (System/currentTimeMillis )]
557
- (Thread/sleep (long (max 0 (- fsync-interval (- end start)))))))
556
+ (let [end (System/nanoTime )]
557
+ (Thread/sleep (long (max 0 (- ( * 1000000 fsync-interval) (- end start)))))))
558
558
(catch Throwable _)))))))
559
559
560
560
; ; populate queues with pre-existing tasks
747
747
" Returns a lazy sequence of tasks that can be consumed in `interval` milliseconds. This will
748
748
terminate after that time has elapsed, even if there are still tasks immediately available."
749
749
[qs q-name interval]
750
- (let [now (System/currentTimeMillis )]
750
+ (let [now (System/nanoTime )]
751
751
(lazy-seq
752
- (let [now' (System/currentTimeMillis )
753
- remaining (- interval (- now' now))]
752
+ (let [now' (System/nanoTime )
753
+ remaining (- ( * 1000000 interval) (- now' now))]
754
754
(when (pos? remaining)
755
755
(let [task (take! qs q-name remaining ::none )]
756
756
(when-not (= ::none task)
757
757
(cons
758
758
task
759
- (interval-task-seq qs q-name (- interval (- (System/currentTimeMillis ) now)))))))))))
759
+ (interval-task-seq qs q-name (- ( * 1000000 interval) (- (System/nanoTime ) now)))))))))))
760
760
761
761
(defn complete!
762
762
" Marks a task as complete."
You can’t perform that action at this time.
0 commit comments