Merge branch '478-cmb-move-adding-removing-rider-to-and-from-cache' into '472-cmb-release'

Move adding/removal of rider to and from rider cache when going online/offline. #478

See merge request jankstudio/resq!555
This commit is contained in:
Korina Cordero 2020-08-26 04:42:18 +00:00
commit ab11e8aee5

View file

@ -215,7 +215,7 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
$rider_id = $rider->getID();
// cache rider location (default to hub)
// TODO: figure out longitude / latitude default
$this->rcache->addActiveRider($rider_id, 0, 0);
// $this->rcache->addActiveRider($rider_id, 0, 0);
// TODO: log rider logging in
@ -285,7 +285,7 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
$rider->setActive(false);
// remove from cache
$this->rcache->removeActiveRider($rider->getID());
// $this->rcache->removeActiveRider($rider->getID());
// remove rider from session
$this->session->setRider(null);
@ -318,6 +318,10 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
$this->em->flush();
// cache rider location (default to hub)
// TODO: figure out longitude / latitude default
$this->rcache->addActiveRider($rider_id, 0, 0);
// send mqtt event to put rider on map
// get rider coordinates from redis
$coord = $this->rider_tracker->getRiderLocation($rider->getID());
@ -367,6 +371,9 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
$this->em->flush();
// remove from cache
$this->rcache->removeActiveRider($rider->getID());
// send mqtt event to remove rider from map
$channel = 'rider/' . $rider->getID() . '/availability';
$payload = [