From 9a87e502f778b042a7ed9b65c054169790febddb Mon Sep 17 00:00:00 2001
From: Tobias Reisinger <tobias@msrg.cc>
Date: Fri, 10 May 2024 13:29:24 +0200
Subject: [PATCH 1/2] Fix some workflow problems

---
 .forgejo/workflows/release.yaml | 26 --------------------------
 Cargo.lock                      |  1 +
 Makefile                        |  2 +-
 3 files changed, 2 insertions(+), 27 deletions(-)
 delete mode 100644 .forgejo/workflows/release.yaml

diff --git a/.forgejo/workflows/release.yaml b/.forgejo/workflows/release.yaml
deleted file mode 100644
index f5fc9b5..0000000
--- a/.forgejo/workflows/release.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
-on:
-  push:
-    tags:
-      - v**
-jobs:
-  build-artifacts:
-    runs-on: docker
-    container:
-      image: registry.serguzim.me/emgauwa/runner
-    strategy:
-      matrix:
-        arch:
-          - x86_64-unknown-linux-gnu # for "standard" systems
-          - x86_64-unknown-linux-musl # for docker
-          - arm-unknown-linux-gnueabihf # for raspberry pi
-    steps:
-      - uses: https://code.forgejo.org/actions/checkout@v3
-      - id: cargo-build-release
-        run: |
-          source "$HOME/.cargo/env"
-          cross build --target ${{ matrix.arch }} --release
-        shell: bash
-      - uses: https://code.forgejo.org/actions/upload-artifact@v3
-        with:
-          name: emgauwa-core_${{ matrix.arch }}
-          path: ${{ github.workspace }}/target/${{ matrix.arch }}/release/emgauwa-core
diff --git a/Cargo.lock b/Cargo.lock
index 9ca1b7e..25b09ed 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -713,6 +713,7 @@ dependencies = [
 [[package]]
 name = "emgauwa-common"
 version = "0.5.0"
+source = "git+https://git.serguzim.me/emgauwa/common.git#b14049b3f6e8aa6a748e4d185bd52ca3f7a38f38"
 dependencies = [
  "actix",
  "actix-web",
diff --git a/Makefile b/Makefile
index 8d69e1e..066cbcc 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ clean:
 	rm -f emgauwa-core.sqlite
 
 emgauwa-core_%:
-	$(TOOL) build --target $* --release --bin emgauwa-core
+	$(TOOL) build --target $* --release
 	mkdir -p out/releases
 	cp target/$*/release/emgauwa-core out/releases/emgauwa-core_$*
 

From 11e1a51a2a2e571d0e51e11f380626f3e4f57cbe Mon Sep 17 00:00:00 2001
From: Tobias Reisinger <tobias@msrg.cc>
Date: Fri, 10 May 2024 18:03:02 +0200
Subject: [PATCH 2/2] Add parameter for db pool size

---
 Cargo.lock  | 1 -
 src/main.rs | 4 +++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 25b09ed..9ca1b7e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -713,7 +713,6 @@ dependencies = [
 [[package]]
 name = "emgauwa-common"
 version = "0.5.0"
-source = "git+https://git.serguzim.me/emgauwa/common.git#b14049b3f6e8aa6a748e4d185bd52ca3f7a38f38"
 dependencies = [
  "actix",
  "actix-web",
diff --git a/src/main.rs b/src/main.rs
index 003633f..d37a39c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -27,7 +27,8 @@ async fn main() -> Result<(), std::io::Error> {
 
 	init_logging(&settings.logging.level)?;
 
-	let pool = emgauwa_common::db::init(&settings.database).await?;
+	let pool_size = 10;
+	let pool = emgauwa_common::db::init(&settings.database, pool_size).await?;
 
 	let mut conn = pool.acquire().await.map_err(EmgauwaError::from)?;
 	DbController::all_inactive(&mut conn)
@@ -112,6 +113,7 @@ async fn main() -> Result<(), std::io::Error> {
 					.service(handlers::v1::ws::ws_relays),
 			)
 	})
+	.workers((pool_size / 2) as usize)
 	.listen(listener)?
 	.run()
 	.await