Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xxdk-wasm
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
xxdk-wasm
Commits
6afbf09a
Commit
6afbf09a
authored
Oct 20, 2022
by
Jono Wenger
Browse files
Options
Downloads
Patches
Plain Diff
Add global tracker for number of cmix followers running
parent
48ea7af6
No related branches found
No related tags found
1 merge request
!18
XX-4272 / Purge
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
wasm/follow.go
+4
-0
4 additions, 0 deletions
wasm/follow.go
wasm/purge.go
+15
-0
15 additions, 0 deletions
wasm/purge.go
with
19 additions
and
0 deletions
wasm/follow.go
+
4
−
0
View file @
6afbf09a
...
@@ -11,6 +11,7 @@ package wasm
...
@@ -11,6 +11,7 @@ package wasm
import
(
import
(
"gitlab.com/elixxir/xxdk-wasm/utils"
"gitlab.com/elixxir/xxdk-wasm/utils"
"sync/atomic"
"syscall/js"
"syscall/js"
)
)
...
@@ -60,6 +61,8 @@ func (c *Cmix) StartNetworkFollower(_ js.Value, args []js.Value) interface{} {
...
@@ -60,6 +61,8 @@ func (c *Cmix) StartNetworkFollower(_ js.Value, args []js.Value) interface{} {
return
nil
return
nil
}
}
atomic
.
AddUint64
(
&
NumClientsRunning
,
1
)
return
nil
return
nil
}
}
...
@@ -77,6 +80,7 @@ func (c *Cmix) StopNetworkFollower(js.Value, []js.Value) interface{} {
...
@@ -77,6 +80,7 @@ func (c *Cmix) StopNetworkFollower(js.Value, []js.Value) interface{} {
utils
.
Throw
(
utils
.
TypeError
,
err
)
utils
.
Throw
(
utils
.
TypeError
,
err
)
return
nil
return
nil
}
}
atomic
.
AddUint64
(
&
NumClientsRunning
,
^
uint64
(
0
))
return
nil
return
nil
}
}
...
...
This diff is collapsed.
Click to expand it.
wasm/purge.go
0 → 100644
+
15
−
0
View file @
6afbf09a
////////////////////////////////////////////////////////////////////////////////
// Copyright © 2022 xx foundation //
// //
// Use of this source code is governed by a license that can be found in the //
// LICENSE file. //
////////////////////////////////////////////////////////////////////////////////
package
wasm
// NumClientsRunning is an atomic that tracks the current number of Cmix
// followers that have been started. Every time one is started, this counter
// must be incremented and every time one is stopped, it must be decremented.
//
// This variable is an atomic. Only access it with atomic functions
var
NumClientsRunning
uint64
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