Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

url cleanup upgrade #148

Open
wants to merge 14 commits into
base: release/0.2.0
Choose a base branch
from
Prev Previous commit
Next Next commit
Update src/services/storage/drivers/inMemory/index.ts
Co-authored-by: lesagi <[email protected]>
  • Loading branch information
shay123g and lesagi committed Mar 16, 2021
commit 6ab10423ef84f731abc66437adece759dba8d008
3 changes: 1 addition & 2 deletions src/services/storage/drivers/inMemory/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ export class InMemoryStorage implements StorageDriver {
let deletedCount = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comment in the PR


this.storage.data.urls.forEach((storedUrl) => {
let relativeDate = new Date(storedUrl.createdAt).getTime()
if (deleteFrom === 'update') relativeDate = new Date(storedUrl.updatedAt).getTime()
const relativeDate = new Date(deleteFrom === 'update' ? storedUrl.updatedAt : storedUrl.createdAt).getTime()
if (relativeDate <= deleteBefore) {
this.storage.data.urls.delete(storedUrl.id)
deletedCount++
Expand Down