Skip to content

Commit

Permalink
update based on the latest project changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wildonion committed May 25, 2024
1 parent 42b1a60 commit 699b90b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Login to DockerHub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin docker.youwho.club
- name: Build and Push
run: | # 1 - build services | 2 - push services to the custom registry
run: | # 1 - build services | 2 - push services to the custom registry hosted on docker.youwho.club
docker compose -f "docker-compose.yml" build
docker compose -f "docker-compose.yml" push
pull-on-server:
Expand Down
22 changes: 11 additions & 11 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@
"scrollbarSlider.activeBackground": "#288bb3",
"scrollbarSlider.background": "#19241b",
"scrollbarSlider.hoverBackground": "#288bb3",
"activityBar.activeBackground": "#26f0b3",
"activityBar.background": "#26f0b3",
"activityBar.activeBackground": "#e5c268",
"activityBar.background": "#e5c268",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#cb6af5",
"activityBarBadge.foreground": "#15202b",
"activityBarBadge.background": "#178868",
"activityBarBadge.foreground": "#e7e7e7",
"commandCenter.border": "#15202b99",
"sash.hoverBorder": "#26f0b3",
"statusBar.background": "#0fd499",
"sash.hoverBorder": "#e5c268",
"statusBar.background": "#ddb03d",
"statusBar.foreground": "#15202b",
"statusBarItem.hoverBackground": "#0ca477",
"statusBarItem.remoteBackground": "#0fd499",
"statusBarItem.hoverBackground": "#c59722",
"statusBarItem.remoteBackground": "#ddb03d",
"statusBarItem.remoteForeground": "#15202b",
"titleBar.activeBackground": "#0fd499",
"titleBar.activeBackground": "#ddb03d",
"titleBar.activeForeground": "#15202b",
"titleBar.inactiveBackground": "#0fd49999",
"titleBar.inactiveBackground": "#ddb03d99",
"titleBar.inactiveForeground": "#15202b99"
},
"rust-analyzer.linkedProjects": [
"./Cargo.toml"
],
"rust-analyzer.showUnlinkedFileNotification": false,
"rust-analyzer.checkOnSave": true,
"peacock.color": "#0fd499"
"peacock.color": "#ddb03d"
}
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ i'm hoopoe, the social event platform to hoop!
### proper way to write and handle async task execution!

> [!IMPORTANT]
> every async task must be spawned in a free thread in the background which can be done via `tokio::spawn()`, it's like creating a worker per each async task.
> every async task must be spawned in a free thread using a background worker which can be done via `tokio::spawn()`, it's like creating a worker per each async task.
```rust
async fn heavy_process(){
Expand All @@ -71,7 +71,7 @@ async fn heavy_process(){
// --> locking logic
}

let (tx, rx) = channel::<()>();
let (tx, rx) = channel::<String>(); // channel for stringified data
let tx = tx.clone();
// spawn in the background and use channel to receive
// data whenever the data is sent to the channel
Expand All @@ -80,7 +80,8 @@ tokio::spawn(async move{
tx.send(res).await;
});
while let Some(data) = rx.recv().await{
// rest of the logics whenever we receive data
// do the rest of the logics in here
// whenever we receive data
// ...
}

Expand All @@ -97,10 +98,12 @@ let task = tokio::spawn(async move{
});

tokio::select! {
// choose this if it can gets completed soon
_ = task => {
// proceed with this flow
// ...
},
// or if you think this gets completed soonly
data = rx.recv() => {
// proceed with this flow
// ...
Expand Down Expand Up @@ -271,6 +274,7 @@ use postman to check the server health and register notif producer and consumer.

### When developing?!

- `net.spec`
- always update:
- erd pictures every time you are finished with developing database tables
- crates and Rust edition!
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ services:
- hoopoe

timescaledb:
container_name: timescaledb
container_name: postgres
image: timescale/timescaledb-ha:pg16
restart: unless-stopped
environment:
Expand Down
6 changes: 3 additions & 3 deletions infra/api.http.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"method": "POST",
"header": [
{
"key": "token_time",
"value": "124kUmD39YUwJRKxaQqTkKb6yjrU7PTkjZHT72xPxWW7JyxSnnGUdHqfSvzn1YUCHHWp63bTP"
"key": "x-api-key",
"value": "124kUmD39YUwJRKxaQqTkkMrFezWXtmhiNXZzX59xjCSS8WAyNk2tjGSrccnc8NhGJAckJyZk"
}
],
"body": {
Expand Down Expand Up @@ -130,7 +130,7 @@
"method": "POST",
"header": [
{
"key": "secret_key",
"key": "x-api-key",
"value": "{{secret_key}}"
}
],
Expand Down

0 comments on commit 699b90b

Please sign in to comment.