Sha256: ea9fc8ac581a9b75e61d189b57db488aa8ff9098e7c12185c7dda2dc3d41e0d7
Contents?: true
Size: 1.24 KB
Versions: 6
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true module Loco class UuidJob < ActiveJob::Base queue_as :loco def perform serialized_resource, uuid, action ws_conn_manager = init_ws_conn_manager serialized_resource return unless ws_conn_manager case action when 'add' add ws_conn_manager, uuid when 'del' del ws_conn_manager, uuid when 'update' update ws_conn_manager, uuid end end protected def add ws_conn_manager, uuid ws_conn_manager.add uuid WsConnectedResourcesManager.add ws_conn_manager.identifier end def del ws_conn_manager, uuid ws_conn_manager.del uuid return if ws_conn_manager.connected_uuids.any? WsConnectedResourcesManager.del ws_conn_manager.identifier end def update ws_conn_manager, uuid ws_conn_manager.update uuid WsConnectedResourcesManager.add ws_conn_manager.identifier end def deserialize_resource hash hash['class'].constantize.find_by id: hash['id'] end def init_ws_conn_manager serialized_resource resource = deserialize_resource serialized_resource return unless resource WsConnectionManager.new resource end end end
Version data entries
6 entries across 6 versions & 1 rubygems