Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Rosekey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
freelynetwork
Rosekey
Commits
1fd9ba8d
Commit
1fd9ba8d
authored
2 years ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
enhance(server): delete outdated notifications regularly to improve db performance
parent
689411c1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
packages/backend/src/queue/processors/CleanProcessorService.ts
+9
-2
9 additions, 2 deletions
...ges/backend/src/queue/processors/CleanProcessorService.ts
with
10 additions
and
2 deletions
CHANGELOG.md
+
1
−
0
View file @
1fd9ba8d
...
...
@@ -25,6 +25,7 @@ You should also include the user name that made the change.
-
Add Cloudflare Turnstile CAPTCHA support @CyberRex0
-
Server: improve syslog performance @syuilo
-
Server: improve note scoring for featured notes @CyberRex0
-
Server: delete outdated notifications regularly to improve db performance @syuilo
-
Client: use tabler-icons instead of fontawesome to better design @syuilo
-
Client: Add new gabber kick sounds (thanks for noizenecio)
-
Client: Compress non-animated PNG files @saschanaz
...
...
This diff is collapsed.
Click to expand it.
packages/backend/src/queue/processors/CleanProcessorService.ts
+
9
−
2
View file @
1fd9ba8d
import
{
Inject
,
Injectable
}
from
'
@nestjs/common
'
;
import
{
In
,
LessThan
,
MoreThan
}
from
'
typeorm
'
;
import
{
DI
}
from
'
@/di-symbols.js
'
;
import
type
{
UserIpsRepository
}
from
'
@/models/index.js
'
;
import
type
{
NotificationsRepository
,
UserIpsRepository
}
from
'
@/models/index.js
'
;
import
type
{
Config
}
from
'
@/config.js
'
;
import
type
Logger
from
'
@/logger.js
'
;
import
{
bindThis
}
from
'
@/decorators.js
'
;
import
{
QueueLoggerService
}
from
'
../QueueLoggerService.js
'
;
import
type
Bull
from
'
bull
'
;
import
{
bindThis
}
from
'
@/decorators.js
'
;
@
Injectable
()
export
class
CleanProcessorService
{
...
...
@@ -19,6 +19,9 @@ export class CleanProcessorService {
@
Inject
(
DI
.
userIpsRepository
)
private
userIpsRepository
:
UserIpsRepository
,
@
Inject
(
DI
.
notificationsRepository
)
private
notificationsRepository
:
NotificationsRepository
,
private
queueLoggerService
:
QueueLoggerService
,
)
{
this
.
logger
=
this
.
queueLoggerService
.
logger
.
createSubLogger
(
'
clean
'
);
...
...
@@ -32,6 +35,10 @@ export class CleanProcessorService {
createdAt
:
LessThan
(
new
Date
(
Date
.
now
()
-
(
1000
*
60
*
60
*
24
*
90
))),
});
this
.
notificationsRepository
.
delete
({
createdAt
:
LessThan
(
new
Date
(
Date
.
now
()
-
(
1000
*
60
*
60
*
24
*
90
))),
});
this
.
logger
.
succ
(
'
Cleaned.
'
);
done
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment