-
-
Save pmyjavec/e7dcdac39914863fb6a0f024fdeb6b3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def execute(cmd) | |
response = nil | |
begin | |
input = prepare_operation(cmd) | |
Log.info "received command: #{input[:command]}, args: #{input[:args]}" | |
semaphore.synchronize { repository.send(input[:command], *input[:args]) } | |
rescue ClientError => e | |
Log.error "input error: #{e.message}" | |
response = 'ERROR' | |
raise e | |
rescue RepositoryError => e | |
Log.error "repository opeartion error: #{e.message}" | |
response = 'FAIL' | |
else | |
Log.info "command OK" | |
response = 'OK' | |
end | |
response | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment