Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
notifications-bot
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
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
archives
notifications-bot
Commits
34d08063
Commit
34d08063
authored
3 years ago
by
Jonah Husson
Browse files
Options
Downloads
Patches
Plain Diff
fix initcreator test
parent
8df8ef75
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!21
Release
,
!18
Batched notification
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
storage/buffer.go
+17
-16
17 additions, 16 deletions
storage/buffer.go
with
17 additions
and
16 deletions
storage/buffer.go
+
17
−
16
View file @
34d08063
...
...
@@ -7,8 +7,6 @@ import (
"sync/atomic"
)
type
NotificationBuffer
struct
{
bufMap
atomic
.
Value
counter
*
int64
...
...
@@ -16,9 +14,13 @@ type NotificationBuffer struct {
func
NewNotificationBuffer
()
*
NotificationBuffer
{
u
:=
int64
(
0
)
return
&
NotificationBuffer
{
sm
:=
sync
.
Map
{}
nb
:=
&
NotificationBuffer
{
counter
:
&
u
,
bufMap
:
atomic
.
Value
{},
}
nb
.
bufMap
.
Store
(
&
sm
)
return
nb
}
func
(
bnm
*
NotificationBuffer
)
Swap
(
maxNotifications
uint
)
map
[
int64
][]
*
pb
.
NotificationData
{
...
...
@@ -51,4 +53,3 @@ func (bnm *NotificationBuffer)Add(n *pb.NotificationData){
c
:=
atomic
.
AddInt64
(
bnm
.
counter
,
1
)
bnm
.
bufMap
.
Load
()
.
(
*
sync
.
Map
)
.
Store
(
strconv
.
FormatInt
(
c
,
16
),
n
)
}
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