Permalink
Browse files

make sure create_time is in seconds, and erase it when a queue is del…

…eted
  • Loading branch information...
1 parent 86540ab commit fbc5548172153a466ea84999e073eab4b488c12e Robey Pointer committed Mar 7, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/main/scala/net/lag/kestrel/PersistentQueue.scala
@@ -44,7 +44,7 @@ class PersistentQueue(val name: String, persistencePath: String, @volatile var c
// age of the last item read from the queue:
private var _currentAge: Duration = 0.milliseconds
-
+
// time the queue was created
private var _createTime = Time.now
@@ -95,7 +95,7 @@ class PersistentQueue(val name: String, persistencePath: String, @volatile var c
def currentAge: Duration = synchronized { if (queueSize == 0) 0.milliseconds else _currentAge }
def waiterCount: Long = synchronized { waiters.size }
def isClosed: Boolean = synchronized { closed || paused }
- def createTime: Long = synchronized { _createTime }
+ def createTime: Long = synchronized { _createTime.inSeconds }
// mostly for unit tests.
def memoryLength: Long = synchronized { queue.size }
@@ -404,6 +404,7 @@ class PersistentQueue(val name: String, persistencePath: String, @volatile var c
Stats.clearGauge(statNamed("age_msec"))
Stats.clearGauge(statNamed("waiters"))
Stats.clearGauge(statNamed("open_transactions"))
+ Stats.clearGauge(statNamed("create_time"))
}
private final def nextXid(): Int = {

0 comments on commit fbc5548

Please sign in to comment.