Skip to content

Commit 0f06737

Browse files
Remove the mutex around running flight-job cmds
1 parent cf94ef0 commit 0f06737

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

api/lib/flight_job_script_api/job_cli.rb

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,6 @@ class CommandError < Sinja::ServiceUnavailable; end
3333

3434
class JobCLI
3535
class << self
36-
# TODO: Remove the mutex
37-
#
38-
# Previously this prevented a user running multiple requests at the same
39-
# time. However this is no longer possible to prevent in threads.
40-
def mutexes
41-
@mutexes ||= Hash.new { |h, k| h[k] = Mutex.new }
42-
end
43-
4436
def list_templates(**opts)
4537
opts = opts.dup
4638
includes = opts.key?(:include) ? ["--include", opts.delete(:include)] : []
@@ -141,17 +133,13 @@ def initialize(*cmd, stdin: nil, env: {})
141133
end
142134

143135
def run(&block)
144-
result =
145-
# TODO: Remove mutext
146-
self.class.mutexes[:todo_remove_me].synchronize do
147-
FlightJobScriptAPI.logger.debug("Running subprocess (#{ENV['USER']}): #{stringified_cmd}")
148-
sp = Subprocess.new(
149-
env: @env,
150-
logger: FlightJobScriptAPI.logger,
151-
timeout: FlightJobScriptAPI.config.command_timeout
152-
)
153-
sp.run(@cmd, @stdin, &block)
154-
end
136+
FlightJobScriptAPI.logger.debug("Running subprocess (#{ENV['USER']}): #{stringified_cmd}")
137+
sp = Subprocess.new(
138+
env: @env,
139+
logger: FlightJobScriptAPI.logger,
140+
timeout: FlightJobScriptAPI.config.command_timeout
141+
)
142+
result = sp.run(@cmd, @stdin, &block)
155143
parse_result(result)
156144
log_command(result)
157145
result

0 commit comments

Comments
 (0)