From f2c327bdf2f9e8682d96efe1c80c87fb7ebe786c Mon Sep 17 00:00:00 2001 From: Dmitry Openkov Date: Fri, 27 Oct 2023 14:39:15 +0300 Subject: [PATCH] Fixing "Expected both _currentTick and _currentTriggerId to be 'None' but found Some" on EndingRefuelSession event --- .../beam/agentsim/agents/ridehail/RideHailAgent.scala | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/scala/beam/agentsim/agents/ridehail/RideHailAgent.scala b/src/main/scala/beam/agentsim/agents/ridehail/RideHailAgent.scala index 30519257885..90e066247fc 100755 --- a/src/main/scala/beam/agentsim/agents/ridehail/RideHailAgent.scala +++ b/src/main/scala/beam/agentsim/agents/ridehail/RideHailAgent.scala @@ -984,6 +984,16 @@ class RideHailAgent( if (debugEnabled) outgoingMessages += ev updateLatestObservedTick(tick) log.debug("state(RideHailingAgent.Refueling.EndingRefuelSession): {}, Vehicle ID: {}", ev, vehicle.id) + if (_currentTriggerId.isDefined) { + //at some point in the past we forgot to release tick and trigger + val (oldTick, oldTrigger) = releaseTickAndTriggerId() + log.warning( + s"Agent $id has tick $oldTick and trigger $oldTrigger" + + s", while holding $tick and $triggerId; event = {}, sender = {}", + ev, + sender() + ) + } holdTickAndTriggerId(tick, triggerId) if (currentBeamVehicle.isRideHailCAV) rideHailManager ! reply