Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-socketCenter
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujiebin
hilo-socketCenter
Commits
7ea1556b
Commit
7ea1556b
authored
Aug 09, 2023
by
iamhujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:调整速率
parent
8e265720
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
main.go
main.go
+5
-5
No files found.
main.go
View file @
7ea1556b
...
@@ -22,8 +22,8 @@ import (
...
@@ -22,8 +22,8 @@ import (
"time"
"time"
)
)
const
SEND_WORKER
=
2000
// 消费端协程数量
const
SEND_WORKER
=
1
// 消费端协程数量
const
MONITOR_LENGTH
=
100
// 队列告警数量
const
MONITOR_LENGTH
=
100
0
// 队列告警数量
const
SocketQueueSendGift
=
"socket:queue:send_gift"
const
SocketQueueSendGift
=
"socket:queue:send_gift"
var
userClient
userCenter
.
UserClient
var
userClient
userCenter
.
UserClient
...
@@ -92,7 +92,7 @@ func main() {
...
@@ -92,7 +92,7 @@ func main() {
mylogrus
.
MyLog
.
Infof
(
"cron sendGiftChan start"
)
mylogrus
.
MyLog
.
Infof
(
"cron sendGiftChan start"
)
// 8核 n send + 4 blpop
// 8核 n send + 4 blpop
sendGiftChan
=
make
(
chan
*
SendGiftMsg
,
SEND_WORKER
)
sendGiftChan
=
make
(
chan
*
SendGiftMsg
,
SEND_WORKER
)
for
i
:=
0
;
i
<
4
;
i
++
{
for
i
:=
0
;
i
<
1
;
i
++
{
go
func
()
{
go
func
()
{
deal
()
deal
()
}()
}()
...
@@ -107,7 +107,7 @@ func main() {
...
@@ -107,7 +107,7 @@ func main() {
}
}
func
check
()
{
func
check
()
{
tick
:=
time
.
NewTicker
(
time
.
Second
*
3
)
tick
:=
time
.
NewTicker
(
time
.
Second
*
3
0
)
defer
tick
.
Stop
()
defer
tick
.
Stop
()
for
{
for
{
select
{
select
{
...
@@ -148,7 +148,7 @@ func deal() {
...
@@ -148,7 +148,7 @@ func deal() {
}
}
sendGiftChan
<-
msg
sendGiftChan
<-
msg
}
}
time
.
Sleep
(
time
.
Second
)
// 控制全服banner速率
time
.
Sleep
(
time
.
Second
*
5
)
// 控制全服banner速率
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment