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
d3b3426e
Unverified
Commit
d3b3426e
authored
6 years ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
Enable job queue
Resolve #3216
parent
4982ea8f
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
src/index.ts
+3
-0
3 additions, 0 deletions
src/index.ts
src/queue/index.ts
+32
-1
32 additions, 1 deletion
src/queue/index.ts
with
35 additions
and
1 deletion
src/index.ts
+
3
−
0
View file @
d3b3426e
...
...
@@ -100,6 +100,9 @@ async function workerMain() {
// start server
await
require
(
'
./server
'
).
default
();
// start processor
require
(
'
./queue
'
).
default
();
if
(
cluster
.
isWorker
)
{
// Send a 'ready' message to parent process
process
.
send
(
'
ready
'
);
...
...
This diff is collapsed.
Click to expand it.
src/queue/index.ts
+
32
−
1
View file @
d3b3426e
import
*
as
Queue
from
'
bee-queue
'
;
import
config
from
'
../config
'
;
import
http
from
'
./processors/http
'
;
import
{
ILocalUser
}
from
'
../models/user
'
;
import
Logger
from
'
../misc/logger
'
;
const
enableQueue
=
config
.
redis
!=
null
;
const
queue
=
new
Queue
(
'
misskey
'
,
{
redis
:
{
port
:
config
.
redis
.
port
,
host
:
config
.
redis
.
host
,
password
:
config
.
redis
.
pass
},
removeOnSuccess
:
true
,
removeOnFailure
:
true
,
getEvents
:
false
,
sendEvents
:
false
,
storeJobs
:
false
});
export
function
createHttpJob
(
data
:
any
)
{
return
http
({
data
},
()
=>
{});
if
(
enableQueue
)
{
return
queue
.
createJob
(
data
)
.
retries
(
4
)
.
backoff
(
'
exponential
'
,
16384
)
// 16s
.
save
();
}
else
{
return
http
({
data
},
()
=>
{});
}
}
export
function
deliver
(
user
:
ILocalUser
,
content
:
any
,
to
:
any
)
{
...
...
@@ -18,3 +43,9 @@ export function deliver(user: ILocalUser, content: any, to: any) {
}
export
const
queueLogger
=
new
Logger
(
'
queue
'
);
export
default
function
()
{
if
(
enableQueue
)
{
queue
.
process
(
128
,
http
);
}
}
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