lib/sensu/server/process.rb
# Updates a Sensu server task lock timestamp. The current task
# server ID is retrieved from Redis and compared with the server
# ID of the current process to determine if it is still
# responsible for the task. If the current process is still
# responsible, the task lock timestamp is updated. If the
# current process is no longer responsible, `relinquish_task()`
# is called for cleanup.
#
# @param task [String]
Updates a Sensu server task lock timestamp. The current task
server ID is retrieved from Redis and compared with the server
ID of the current process to determine if it is still
responsible for the task. If the current process is still
responsible, the task lock timestamp is updated. If the
current process is no longer responsible, `relinquish_task()`
is called for cleanup.
Updates a Sensu server task lock timestamp . The current task server ID is retrieved from Redis and compared with the server ID of the current process to determine if it is still responsible for the task . If the current process is still responsible the task lock timestamp is updated . If the current process is no longer responsible ` relinquish_task () ` is called for cleanup .
def update_task_lock(task)
        @redis.get("task:#{task}:server") do |current_server_id|
          if current_server_id == server_id
            @redis.set("lock:task:#{task}", create_lock_timestamp) do
              @logger.debug("updated task lock timestamp", :task => task)
            end
          else
            @logger.warn("another sensu server is responsible for the task", :task => task)
            relinquish_task(task)
          end
        end
      end
def update_task_lock ( task ) @redis . get ( "task:#{task}:server" ) do | current_server_id | if current_server_id == server_id @redis . set ( "lock:task:#{task}" , create_lock_timestamp ) do @logger . debug ( "updated task lock timestamp" , :task => task ) end else @logger . warn ( "another sensu server is responsible for the task" , :task => task ) relinquish_task ( task ) end end end
Updates a Sensu server task lock timestamp.
Updates a Sensu server task lock timestamp .
task
None