Skip to content

Commit 7a8947f

Browse files
committed
reduce CPU usages; bump 0.0.4
1 parent aba66bd commit 7a8947f

File tree

6 files changed

+15
-10
lines changed

6 files changed

+15
-10
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "calcit_wss"
3-
version = "0.0.3"
3+
version = "0.0.4"
44
authors = ["jiyinyiyong <[email protected]>"]
55
edition = "2021"
66

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ wss.core/wss-serve!
1818

1919
Install to `~/.config/calcit/modules/`, compile and provide `*.{dylib,so}` file with `./build.sh`.
2020

21+
### Develop
22+
23+
Run buildin demo with:
24+
25+
```bash
26+
cr -1 --init-fn wss.test/demo!
27+
```
28+
2129
### Workflow
2230

2331
https://github.com/calcit-lang/dylib-workflow

calcit.cirru

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compact.cirru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{} (:package |wss)
33
:configs $ {} (:init-fn |wss.test/main!) (:reload-fn |wss.test/reload!)
44
:modules $ []
5-
:version |0.0.2
5+
:version |0.0.4
66
:files $ {}
77
|wss.core $ {}
88
:ns $ quote

src/lib.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,7 @@ pub fn wss_serve(
3737

3838
spawn(move || {
3939
loop {
40-
let event = match event_hub.next_event() {
41-
Some(e) => e,
42-
None => continue,
43-
};
44-
45-
match event {
40+
match event_hub.poll_event() {
4641
Event::Connect(client_id, responder) => {
4742
{
4843
// add their Responder to our `clients` map:
@@ -68,6 +63,8 @@ pub fn wss_serve(
6863
])]) {
6964
println!("Failed to handle disconnect: {}", e)
7065
}
66+
67+
break;
7168
}
7269
Event::Message(client_id, message) => match message {
7370
Message::Text(s) => {

0 commit comments

Comments
 (0)