Class: MeiliSearch::Task
Constant Summary
collapse
- ALLOWED_PARAMS =
[
:limit, :from, :index_uids, :types, :statuses, :uids, :canceled_by,
:before_enqueued_at, :after_enqueued_at, :before_started_at, :after_started_at,
:before_finished_at, :after_finished_at
].freeze
- ALLOWED_CANCELATION_PARAMS =
(ALLOWED_PARAMS - [:limit, :from]).freeze
Constants inherited
from HTTPRequest
HTTPRequest::DEFAULT_OPTIONS
Instance Attribute Summary
Attributes inherited from HTTPRequest
#headers, #options
Instance Method Summary
collapse
Methods inherited from HTTPRequest
#http_delete, #http_get, #http_patch, #http_post, #http_put, #initialize
Instance Method Details
#cancel_tasks(options) ⇒ Object
#delete_tasks(options) ⇒ Object
#index_task(task_uid) ⇒ Object
27
28
29
|
# File 'lib/meilisearch/task.rb', line 27
def index_task(task_uid)
http_get "/tasks/#{task_uid}"
end
|
#index_tasks(index_uid) ⇒ Object
23
24
25
|
# File 'lib/meilisearch/task.rb', line 23
def index_tasks(index_uid)
http_get '/tasks', { indexUids: [index_uid].flatten.join(',') }
end
|
#task(task_uid) ⇒ Object
19
20
21
|
# File 'lib/meilisearch/task.rb', line 19
def task(task_uid)
http_get "/tasks/#{task_uid}"
end
|
#task_list(options = {}) ⇒ Object
#wait_for_task(task_uid, timeout_in_ms = 5000, interval_in_ms = 50) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/meilisearch/task.rb', line 39
def wait_for_task(task_uid, timeout_in_ms = 5000, interval_in_ms = 50)
Timeout.timeout(timeout_in_ms.to_f / 1000) do
loop do
task = task(task_uid)
return task if achieved_task?(task)
sleep interval_in_ms.to_f / 1000
end
end
rescue Timeout::Error
raise MeiliSearch::TimeoutError
end
|