Commit 83fd3f5c authored by Alex Kalderimis's avatar Alex Kalderimis

Improve argument handling

This uses kwargs instead of a hash-parameter, avoiding ruby 2.7+
warnings, and also avoiding the need to index into the arguments.
parent 2df95811
......@@ -33,9 +33,9 @@ module Mutations
super
end
def resolve(args)
def resolve(queue_name:, **args)
{
result: Gitlab::SidekiqQueue.new(args[:queue_name]).drop_jobs!(args, timeout: 30),
result: Gitlab::SidekiqQueue.new(queue_name).drop_jobs!(args, timeout: 30),
errors: []
}
rescue Gitlab::SidekiqQueue::NoMetadataError
......@@ -44,7 +44,7 @@ module Mutations
errors: ['No metadata provided']
}
rescue Gitlab::SidekiqQueue::InvalidQueueError
raise Gitlab::Graphql::Errors::ResourceNotAvailable, "Queue #{args[:queue_name]} not found"
raise Gitlab::Graphql::Errors::ResourceNotAvailable, "Queue #{queue_name} not found"
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment