Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
fix stale message filtering. now has a utc/local mismatch somehow.
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcd-msft committed Apr 25, 2019
1 parent ac59fd9 commit 11fd080
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,13 @@ private static async Task<MessageResponse> OnFruitMessageReceived(Message msg, o
}
if (originalEventUTC >= module._lastFruitUTC)
{
Log.WriteLine("FruitMsgHandler invoking event. original event UTC {0}", originalEventUTC.ToString("o"));
Log.WriteLine("FruitMsgHandler invoking event. original event UTC {0} prev {1}", originalEventUTC.ToString("o"), module._lastFruitUTC.ToString("o"));
await Task.Run(() => module.FruitChanged?.Invoke(module, fruitMsg.FruitSeen));
module._lastFruitUTC = originalEventUTC;
}
else
{
Log.WriteLine("FruitMsgHandler ignoring stale message. original event UTC {1}", originalEventUTC.ToString("o"));
Log.WriteLine("FruitMsgHandler ignoring stale message. original event UTC {0} prev {1}", originalEventUTC.ToString("o"), module._lastFruitUTC.ToString("o"));
}
return MessageResponse.Completed;
}
Expand Down Expand Up @@ -135,12 +136,14 @@ private Task<MethodResponse> SetFruit(MethodRequest req, Object context)
}
if (originalEventUTC >= _lastFruitUTC)
{
Log.WriteLine("SetFruit invoking event. original event UTC {0}", originalEventUTC.ToString("o"));
Log.WriteLine("SetFruit invoking event. original event UTC {0} prev {1}", originalEventUTC.ToString("o"), _lastFruitUTC.ToString("o"));
AzureModule module = (AzureModule)context;
module.FruitChanged?.Invoke(module, fruitMsg.FruitSeen);
} else
_lastFruitUTC = originalEventUTC;
}
else
{
Log.WriteLine("SetFruit ignoring stale message. original event UTC {1}", originalEventUTC.ToString("o"));
Log.WriteLine("SetFruit ignoring stale message. original event UTC {0} prev {1}", originalEventUTC.ToString("o"), _lastFruitUTC.ToString("o"));
}
// Acknowlege the direct method call with a 200 success message
string result = "{\"result\":\"Executed direct method: " + req.Name + "\"}";
Expand Down

0 comments on commit 11fd080

Please sign in to comment.