fix(db): limits max connection to avoid data loss
This commit is contained in:
parent
9db0a7013a
commit
b8fd649ccf
2 changed files with 3 additions and 0 deletions
|
|
@ -131,6 +131,8 @@ func main() {
|
||||||
slog.Warn("Failed to set busy timeout", "error", err)
|
slog.Warn("Failed to set busy timeout", "error", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db.SetMaxOpenConns(1)
|
||||||
|
|
||||||
// Create table
|
// Create table
|
||||||
createTableSQL := `CREATE TABLE IF NOT EXISTS drone_events (
|
createTableSQL := `CREATE TABLE IF NOT EXISTS drone_events (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ public class TelemetryService {
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
try {
|
try {
|
||||||
String json = mapper.writeValueAsString(event);
|
String json = mapper.writeValueAsString(event);
|
||||||
|
System.out.println("[INFO] Sending telemetry event: " + json);
|
||||||
var request = java.net.http.HttpRequest.newBuilder()
|
var request = java.net.http.HttpRequest.newBuilder()
|
||||||
.uri(java.net.URI.create(BLACKBOX_URL + "/ingest"))
|
.uri(java.net.URI.create(BLACKBOX_URL + "/ingest"))
|
||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue