mirror of
https://github.com/koreanbots/core.git
synced 2025-12-16 14:30:22 +00:00
feat: CACHING AND FETCH
This commit is contained in:
parent
1f6afbe309
commit
067b4fa941
@ -1,8 +1,13 @@
|
|||||||
import DataLoader from 'dataloader'
|
import DataLoader from 'dataloader'
|
||||||
import * as Query from './Query'
|
import * as Query from './Query'
|
||||||
|
|
||||||
const loaders = {
|
const Fetch = {
|
||||||
bor: new DataLoader(async (ids:string[]) => await Promise.all(ids.map((el:string)=> Query.getBot(el)))),
|
bot: new DataLoader(async (ids:string[]) => await Promise.all(ids.map((el:string)=> Query.getBot(el))), {
|
||||||
user: new DataLoader(async (ids:string[]) => await Promise.all(ids.map((el:string)=> Query.getUser(el)))),
|
batchScheduleFn: callback => setTimeout(callback, 1000)
|
||||||
|
}),
|
||||||
|
user: new DataLoader(async (ids:string[]) => await Promise.all(ids.map((el:string)=> Query.getUser(el))), {
|
||||||
|
batchScheduleFn: callback => setTimeout(callback, 1000)
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Fetch
|
||||||
Loading…
x
Reference in New Issue
Block a user