Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
make sure create_time is in seconds, and erase it when a queue is del…
Browse files Browse the repository at this point in the history
…eted
  • Loading branch information
Robey Pointer committed Mar 7, 2012
1 parent 86540ab commit fbc5548
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/scala/net/lag/kestrel/PersistentQueue.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit fbc5548

Please sign in to comment.