feat(medusa): Move search indexing into a separate subscriber to defer the work load (#1874)
**What**
Move the preliminary indexing action at boot time to a separate subscriber in order to defer the work load in the background and therefore to avoid increasing the load time when the number of products increase with time.
**Tests**
Add 10k products (since it is our limit, tried with 50k before getting the error limit) using
```sal
do $$
declare
counter integer := 0;
begin
while counter < 10000 loop
INSERT INTO product (id, title, description, handle, profile_id)
(SELECT * FROM ((SELECT random(), random(), random(), random(), 'sp_01FNB9K7FXB0SZMKXD013RJYSP')) as T);
counter := counter + 1;
end loop;
end$$;
```
then start the server and while the server is starting, hit the search end point repeatedly
FIXES CORE-258
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
1 parent
0e0b131488
commit
b8ddb31f6f
6 files changed
+122
-61
No files matched your search
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"medusa-interfaces": patch
|
||||
"@medusajs/medusa": patch
|
||||
---
|
||||
|
||||
Move search indexing into a separate subscriber to defer the work load
|
||||
Reference in new issue
Block a user