Skip to content

Commit 7c1b67e

Browse files
committed
feat: Speed up triggers query
When querying the triggers on the `worker` field, it uses a stack route that will complete the trigger information with jobs. This is costful, as it makes additional database requests, and useless at startup time. So, we now uses a `partialIndex` that will uses the `/find` route and make a faster query. See https://github.com/cozy/cozy-client/blob/c6762bb0c1fad4ac62f18b4118c8577a749caf2b/packages/cozy-stack-client/src/TriggerCollection.js#L125 and https://github.com/cozy/cozy-stack/blob/master/docs/jobs.md#post-jobstriggers
1 parent a35d27b commit 7c1b67e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/queries.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const makeTriggersQuery = {
1818
definition: () => {
1919
return Q('io.cozy.triggers')
2020
.partialIndex({
21-
worker: 'konnector'
21+
worker: { $in: ['client', 'konnector'] } // client is for CLISK
2222
})
2323
.limitBy(1000)
2424
},

0 commit comments

Comments
 (0)