-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve TaskClient
, BatchClient
and associated types
#1825
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1825 +/- ##
==========================================
- Coverage 98.84% 98.71% -0.14%
==========================================
Files 17 17
Lines 1565 1400 -165
Branches 338 291 -47
==========================================
- Hits 1547 1382 -165
Misses 18 18 ☔ View full report in Codecov by Sentry. |
TaskClient
, BatchClient
, associated types, and settings typesTaskClient
, BatchClient
and associated types
For some reason it's a lot slower, whereas it should be faster. I'll investigate. |
Okay, solved the slowness problem. Next, there's a lot of apply wait task. Should probably integrate it with http requests instead. |
Pull Request
What does this PR do?
Batch
,EnqueuedTask
andTask
*Object
equivalent objects, that come from the API responses, for the most part with the same exact properties and valuesDate
objects, but this functionality is also being removed, because:meilisearch
Rust source codeEnqueuedTaskObject
toEnqueuedTask
canceledBy
property as it doesn't existindexUid
property cannot beundefined
but can benull
BatchObject
toBatch
, adjust propertiesTaskObject
toTask
, adjust propertiesTask.details
had quite a few properties missing, likepagination
, now it's reusing theSettings
type, so we don't repeat ourselvesTaskClient
waitForTask
, now it usessetTimeout
for timeout instead of inaccurate expensive date calculationsEnqueuedTask
object as parameterwaitForTasks
can now accept an iterable or an asynchronous iterable instead of just an array as parameterwaitForTasksIter
, which is an asynchronous generator, that lazily awaits the tasksPromise<EnqueuedTask>
now instead returns anEnqueuedTaskPromise
Promise<EnqueuedTask>
with an extra methodwaitTask
, that first gets theEnqueuedTask
and then internally callsTaskClient.waitForTask
on it to return aPromise<Task>
, avoiding quite a bit of boilerplateConfig
:defaultWaitOptions
- used to set the default wait options forTaskClient
interval
for waiting tasks in tests, thus making tests complete often in under 2 minutesCaution
TaskClient
is no longer exported, use it throughMeilisearch
orIndex
instead, on both available astasks
propertyBatchClient
which isn't exported in the index fileBatch
class is only a type nowEnqueuedTask
class is only a type nowTask
class is only a type nowDate
before is now a stringDate
is left to the user (new Date(str)
)PR checklist
Please check if your PR fulfills the following requirements:
Thank you so much for contributing to Meilisearch!