Skip to content

Commit d6f860f

Browse files
committed
Avoid MeiliSearch call when there are no hooked collections
1 parent 42c38de commit d6f860f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

config/functions/bootstrap.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ function addHookedCollectionsToStore ({ store, collections }) {
4444
})
4545
}
4646

47+
async function getHookedCollectionsFromStore ({ store }) {
48+
return store.get('meilisearch_hooked')
49+
}
50+
4751
function addLifecycles ({ client, collections }) {
4852
// Add lifecyles
4953
collections.map(collection => {
@@ -64,8 +68,9 @@ function addLifecycles ({ client, collections }) {
6468
async function initHooks (store) {
6569
try {
6670
const credentials = await getCredentials()
67-
console.log({ credentials })
68-
if (credentials.host) {
71+
const getHookedCollections = await getHookedCollectionsFromStore({ store })
72+
73+
if (credentials.host && getHookedCollections) {
6974
const client = await getClient(credentials)
7075
// get list of indexes in MeiliSearch Instance
7176
const indexes = (await getIndexes(client)).map(index => index.uid)

0 commit comments

Comments
 (0)