Skip to content

Commit

Permalink
Fix possible increment of tracked notification count when message has…
Browse files Browse the repository at this point in the history
… exceeded max attempts

Fixes Redth#331
  • Loading branch information
Redth committed Oct 14, 2014
1 parent dcbab79 commit 5b3c8c1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions PushSharp.Core/PushServiceBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,16 @@ private void QueueNotification(INotification notification, bool countsAsRequeue
{
lastNotificationQueueTime = DateTime.UtcNow;

Interlocked.Increment(ref trackedNotificationCount);

//Measure when the message entered the queue
notification.EnqueuedTimestamp = DateTime.UtcNow;

if (this.cancelTokenSource.IsCancellationRequested)
throw new ObjectDisposedException("Service", "Service has already been signaled to stop");

if (this.ServiceSettings.MaxNotificationRequeues < 0 ||
notification.QueuedCount <= this.ServiceSettings.MaxNotificationRequeues)
{
//Reset the Enqueued time in case this is a requeue
{
// Increment our counter
Interlocked.Increment(ref trackedNotificationCount);

//Reset Enqueued time in case this is a requeue
notification.EnqueuedTimestamp = DateTime.UtcNow;

//Increase the queue counter
Expand Down

0 comments on commit 5b3c8c1

Please sign in to comment.