fix(db): limits max connection to avoid data loss

This commit is contained in:
js0ny 2025-12-06 11:09:40 +00:00
parent 9db0a7013a
commit b8fd649ccf
2 changed files with 3 additions and 0 deletions

View file

@ -131,6 +131,8 @@ func main() {
slog.Warn("Failed to set busy timeout", "error", err)
}
db.SetMaxOpenConns(1)
// Create table
createTableSQL := `CREATE TABLE IF NOT EXISTS drone_events (
id INTEGER PRIMARY KEY AUTOINCREMENT,

View file

@ -53,6 +53,7 @@ public class TelemetryService {
CompletableFuture.runAsync(() -> {
try {
String json = mapper.writeValueAsString(event);
System.out.println("[INFO] Sending telemetry event: " + json);
var request = java.net.http.HttpRequest.newBuilder()
.uri(java.net.URI.create(BLACKBOX_URL + "/ingest"))
.header("Content-Type", "application/json")