Sha256: dbf49f4eac1d91cdf9b26104c7caf5a0b9472e2bbeb0124cbb2162df5e9ee6b6

Contents?: true

Size: 1.52 KB

Versions: 17

Compression:

Stored size: 1.52 KB

Contents

#!/usr/bin/ruby
#
# This file is part of CPEE.
#
# CPEE is free software: you can redistribute it and/or modify it under the terms
# of the GNU General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.  See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# CPEE (file COPYING in the main directory).  If not, see
# <http://www.gnu.org/licenses/>.

require 'json'
require 'redis'
require 'daemonite'

Daemonite.new do |opts|
  redis = Redis.new(path: "/tmp/redis.sock", db: 3)
  pubsubredis = Redis.new(path: "/tmp/redis.sock", db: 3)

  run do
    pubsubredis.psubscribe('callback-end:*') do |on|
      on.pmessage do |pat, what, message|
        _, key = what.split(':')
        index = message.index(' ')
        instance = message[0...index]
        redis.multi do |multi|
          multi.srem("instance:#{instance}/callbacks",key)
          multi.del("instance:#{instance}/callback/#{key}/uuid")
          multi.del("instance:#{instance}/callback/#{key}/label")
          multi.del("instance:#{instance}/callback/#{key}/position")
          multi.del("instance:#{instance}/callback/#{key}/type")
        end
      rescue => e
        puts e.message
        puts e.backtrace
      end
    end
  end
end.go!

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
cpee-2.0.19 server/routing/end.rb
cpee-2.0.18 server/routing/end.rb
cpee-2.0.17 server/routing/end.rb
cpee-2.0.16 server/routing/end.rb
cpee-2.0.15 server/routing/end.rb
cpee-2.0.14 server/routing/end.rb
cpee-2.0.13 server/routing/end.rb
cpee-2.0.11 server/routing/end.rb
cpee-2.0.9 server/routing/end.rb
cpee-2.0.8 server/routing/end.rb
cpee-2.0.7 server/routing/end.rb
cpee-2.0.6 server/routing/end.rb
cpee-2.0.5 server/routing/end.rb
cpee-2.0.3 server/routing/end.rb
cpee-2.0.2 server/routing/end.rb
cpee-2.0.1 server/routing/end.rb
cpee-2.0 server/routing/end.rb