def station_snapshot_update(request, station_id): from ordering.station_connection_manager import _do_push station = Station.by_id(station_id) # send push ws = station.work_stations.filter(accept_shared_rides=True)[0] if ws: _do_push(ws, {"action": "get_snapshot"}) return HttpResponse("OK")
def send_update(station, payload): """ send payload to all online, sharing workstation of station @param station: @param payload: """ from ordering.station_connection_manager import _do_push work_stations = station.work_stations.filter(is_online=True, accept_shared_rides=True) logging.info("update work stations in station [%s] with payload [%s]: %s" % (station, payload, work_stations)) for ws in work_stations: _do_push(ws, payload) if not work_stations: logging.warning( u"Station [%s] is offline and missed a ride update: %s" % (station.name, payload))