Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
jsonrpsee
Commits
366176a8
Commit
366176a8
authored
Apr 26, 2022
by
Niklas Adolfsson
Browse files
print subscription info; once per minute
parent
c715492b
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/src/server/rpc_module.rs
View file @
366176a8
...
...
@@ -25,6 +25,7 @@
// DEALINGS IN THE SOFTWARE.
use
std
::
collections
::
hash_map
::
Entry
;
use
std
::
collections
::
BTreeMap
;
use
std
::
fmt
::{
self
,
Debug
};
use
std
::
future
::
Future
;
use
std
::
ops
::{
Deref
,
DerefMut
};
...
...
@@ -703,6 +704,21 @@ impl<Context: Send + Sync + 'static> RpcModule<Context> {
);
}
let
subscribers2
=
subscribers
.clone
();
std
::
thread
::
spawn
(
move
||
loop
{
let
mut
conns
=
BTreeMap
::
new
();
for
(
key
,
_
)
in
subscribers2
.lock
()
.iter
()
{
conns
.entry
(
key
.conn_id
)
.and_modify
(|
c
|
*
c
+=
1
)
.or_insert
(
1
);
}
let
mut
v
:
Vec
<
_
>
=
conns
.into_iter
()
.collect
();
v
.sort_by
(|
&
(
_
,
a
),
&
(
_
,
b
)|
b
.cmp
(
&
a
));
tracing
::
info!
(
"active subscription `{}`: {:?}"
,
subscribe_method_name
,
v
);
std
::
thread
::
sleep
(
std
::
time
::
Duration
::
from_secs
(
60
))
});
// Unsubscribe
{
self
.methods
.mut_callbacks
()
.insert
(
...
...
ws-server/src/server.rs
View file @
366176a8
...
...
@@ -141,7 +141,12 @@ impl<M: Middleware> Server<M> {
},
)));
tracing
::
info!
(
"Accepting new connection, {}/{}"
,
connections
.count
(),
self
.cfg.max_connections
);
tracing
::
info!
(
"Accepting new connection={}, {}/{}"
,
id
,
connections
.count
(),
self
.cfg.max_connections
);
id
=
id
.wrapping_add
(
1
);
}
...
...
Niklas Adolfsson
@niklasad1
mentioned in commit
eb5f7f2f
·
Apr 29, 2022
mentioned in commit
eb5f7f2f
mentioned in commit eb5f7f2f868b09468e3d7649d67a96cd23d061d6
Toggle commit list
Niklas Adolfsson
@niklasad1
mentioned in commit
8e945de4
·
Apr 29, 2022
mentioned in commit
8e945de4
mentioned in commit 8e945de45be658913ae9aac043d39c510019a73e
Toggle commit list
Write
Preview
Supports
Markdown
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