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 ...@@ -33,9 +33,9 @@ module Mutations
super super
end 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: [] errors: []
} }
rescue Gitlab::SidekiqQueue::NoMetadataError rescue Gitlab::SidekiqQueue::NoMetadataError
...@@ -44,7 +44,7 @@ module Mutations ...@@ -44,7 +44,7 @@ module Mutations
errors: ['No metadata provided'] errors: ['No metadata provided']
} }
rescue Gitlab::SidekiqQueue::InvalidQueueError 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 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