Skip to content

Commit fbc5548

Browse files
author
Robey Pointer
committed
make sure create_time is in seconds, and erase it when a queue is deleted
1 parent 86540ab commit fbc5548

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/scala/net/lag/kestrel/PersistentQueue.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class PersistentQueue(val name: String, persistencePath: String, @volatile var c
4444

4545
// age of the last item read from the queue:
4646
private var _currentAge: Duration = 0.milliseconds
47-
47+
4848
// time the queue was created
4949
private var _createTime = Time.now
5050

@@ -95,7 +95,7 @@ class PersistentQueue(val name: String, persistencePath: String, @volatile var c
9595
def currentAge: Duration = synchronized { if (queueSize == 0) 0.milliseconds else _currentAge }
9696
def waiterCount: Long = synchronized { waiters.size }
9797
def isClosed: Boolean = synchronized { closed || paused }
98-
def createTime: Long = synchronized { _createTime }
98+
def createTime: Long = synchronized { _createTime.inSeconds }
9999

100100
// mostly for unit tests.
101101
def memoryLength: Long = synchronized { queue.size }
@@ -404,6 +404,7 @@ class PersistentQueue(val name: String, persistencePath: String, @volatile var c
404404
Stats.clearGauge(statNamed("age_msec"))
405405
Stats.clearGauge(statNamed("waiters"))
406406
Stats.clearGauge(statNamed("open_transactions"))
407+
Stats.clearGauge(statNamed("create_time"))
407408
}
408409

409410
private final def nextXid(): Int = {

0 commit comments

Comments
 (0)