mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-16 01:29:09 +00:00
feat(api): add rate-limiting and /clear-guild-cache (#198)
This commit is contained in:
parent
57d83699d5
commit
a4fd37d71c
7 changed files with 138 additions and 12 deletions
|
@ -171,10 +171,23 @@ const rebuild = () =>
|
|||
|
||||
const watcher = chokidar.watch(path.resolve(__dirname, basePath), {
|
||||
ignoreInitial: true,
|
||||
ignore: '**/{dist,node_modules}',
|
||||
ignore: '**/dist',
|
||||
});
|
||||
|
||||
let currentlyRebuilding = false;
|
||||
|
||||
watcher.on('all', async (type, path) => {
|
||||
if (path.includes('node_modules') || path.includes('dist')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentlyRebuilding) {
|
||||
console.info('change skipped...', { type, path });
|
||||
return;
|
||||
}
|
||||
|
||||
currentlyRebuilding = true;
|
||||
|
||||
if (path.includes('dist')) {
|
||||
return;
|
||||
}
|
||||
|
@ -183,6 +196,8 @@ watcher.on('all', async (type, path) => {
|
|||
|
||||
await rebuild();
|
||||
reload();
|
||||
|
||||
currentlyRebuilding = false;
|
||||
});
|
||||
|
||||
fork(async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue