mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
debug test error
This commit is contained in:
parent
a284884398
commit
2b9a6b26f6
3 changed files with 14 additions and 10 deletions
|
|
@ -8,7 +8,7 @@
|
|||
],
|
||||
"license": "UNLICENSED",
|
||||
"scripts": {
|
||||
"test": "lerna run --no-bail test --ignore @omnivore/web",
|
||||
"test": "lerna run test --ignore @omnivore/web",
|
||||
"lint": "lerna run lint --ignore @omnivore/web",
|
||||
"build": "lerna run build --ignore @omnivore/web",
|
||||
"bootstrap": "lerna bootstrap",
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ const isPrivateIP = privateIpLib.default
|
|||
const getPriorityByRateLimit = async (
|
||||
userId: string
|
||||
): Promise<'low' | 'high'> => {
|
||||
const count = await countByCreatedAt(new Date(Date.now() - 60 * 1000))
|
||||
const count = await countByCreatedAt(userId, new Date(Date.now() - 60 * 1000))
|
||||
return count >= 5 ? 'low' : 'high'
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -427,17 +427,21 @@ export const findLibraryItemsByPrefix = async (
|
|||
}
|
||||
|
||||
export const countByCreatedAt = async (
|
||||
userId: string,
|
||||
startDate = new Date(0),
|
||||
endDate = new Date()
|
||||
): Promise<number> => {
|
||||
return authTrx(async (tx) =>
|
||||
tx
|
||||
.createQueryBuilder(LibraryItem, 'library_item')
|
||||
.where('library_item.created_at between :startDate and :endDate', {
|
||||
startDate,
|
||||
endDate,
|
||||
})
|
||||
.getCount()
|
||||
return authTrx(
|
||||
async (tx) =>
|
||||
tx
|
||||
.createQueryBuilder(LibraryItem, 'library_item')
|
||||
.where('library_item.created_at between :startDate and :endDate', {
|
||||
startDate,
|
||||
endDate,
|
||||
})
|
||||
.getCount(),
|
||||
undefined,
|
||||
userId
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue