Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
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
Dima Krasner
Sharkey
Commits
84178ba3
Commit
84178ba3
authored
5 years ago
by
MeiMei
Committed by
syuilo
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
APの流量制限とリトライ期間の変更 (#5734)
* AP rate limit * AP Job attempts * fix
parent
46aaf8fa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.config/example.yml
+8
-0
8 additions, 0 deletions
.config/example.yml
src/config/types.ts
+4
-0
4 additions, 0 deletions
src/config/types.ts
src/queue/index.ts
+10
-6
10 additions, 6 deletions
src/queue/index.ts
with
22 additions
and
6 deletions
.config/example.yml
+
8
−
0
View file @
84178ba3
...
...
@@ -125,6 +125,14 @@ autoAdmin: true
# deliverJobConcurrency: 128
# inboxJobConcurrency: 16
# Job rate limiter
# deliverJobPerSec: 128
# inboxJobPerSec: 16
# Job attempts
# deliverJobMaxAttempts: 12
# inboxJobMaxAttempts: 8
# IP address family used for outgoing request (ipv4, ipv6 or dual)
#outgoingAddressFamily: ipv4
...
...
This diff is collapsed.
Click to expand it.
src/config/types.ts
+
4
−
0
View file @
84178ba3
...
...
@@ -47,6 +47,10 @@ export type Source = {
deliverJobConcurrency
?:
number
;
inboxJobConcurrency
?:
number
;
deliverJobPerSec
?:
number
;
inboxJobPerSec
?:
number
;
deliverJobMaxAttempts
?:
number
;
inboxJobMaxAttempts
?:
number
;
syslog
:
{
host
:
string
;
...
...
This diff is collapsed.
Click to expand it.
src/queue/index.ts
+
10
−
6
View file @
84178ba3
...
...
@@ -13,7 +13,7 @@ import { queueLogger } from './logger';
import
{
DriveFile
}
from
'
../models/entities/drive-file
'
;
import
{
getJobInfo
}
from
'
./get-job-info
'
;
function
initializeQueue
(
name
:
string
)
{
function
initializeQueue
(
name
:
string
,
limitPerSec
=
-
1
)
{
return
new
Queue
(
name
,
{
redis
:
{
port
:
config
.
redis
.
port
,
...
...
@@ -21,7 +21,11 @@ function initializeQueue(name: string) {
password
:
config
.
redis
.
pass
,
db
:
config
.
redis
.
db
||
0
,
},
prefix
:
config
.
redis
.
prefix
?
`
${
config
.
redis
.
prefix
}
:queue`
:
'
queue
'
prefix
:
config
.
redis
.
prefix
?
`
${
config
.
redis
.
prefix
}
:queue`
:
'
queue
'
,
limiter
:
limitPerSec
>
0
?
{
max
:
limitPerSec
*
5
,
duration
:
5000
}
:
undefined
});
}
...
...
@@ -33,8 +37,8 @@ function renderError(e: Error): any {
};
}
export
const
deliverQueue
=
initializeQueue
(
'
deliver
'
);
export
const
inboxQueue
=
initializeQueue
(
'
inbox
'
);
export
const
deliverQueue
=
initializeQueue
(
'
deliver
'
,
config
.
deliverJobPerSec
||
128
);
export
const
inboxQueue
=
initializeQueue
(
'
inbox
'
,
config
.
inboxJobPerSec
||
16
);
export
const
dbQueue
=
initializeQueue
(
'
db
'
);
export
const
objectStorageQueue
=
initializeQueue
(
'
objectStorage
'
);
...
...
@@ -85,7 +89,7 @@ export function deliver(user: ILocalUser, content: any, to: any) {
};
return
deliverQueue
.
add
(
data
,
{
attempts
:
8
,
attempts
:
config
.
deliverJobMaxAttempts
||
12
,
backoff
:
{
type
:
'
exponential
'
,
delay
:
60
*
1000
...
...
@@ -102,7 +106,7 @@ export function inbox(activity: any, signature: httpSignature.IParsedSignature)
};
return
inboxQueue
.
add
(
data
,
{
attempts
:
8
,
attempts
:
config
.
inboxJobMaxAttempts
||
8
,
backoff
:
{
type
:
'
exponential
'
,
delay
:
1000
...
...
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