Sha256: 71edfce3590eccb057b18b3f500b660fc4b6426e40190267bc86675ea2fb24f8
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
loco-rails-4.1.1 | app/jobs/loco/uuid_job.rb |
loco-rails-4.1.0 | app/jobs/loco/uuid_job.rb |
loco-rails-4.0.0 | app/jobs/loco/uuid_job.rb |