Compare commits
No commits in common. "b5791e784b0306ca5e1c7aadf65efd0c1f267355" and "4b60f599566647ccb64f2c853130d559c586b48a" have entirely different histories.
b5791e784b
...
4b60f59956
3 changed files with 5 additions and 15 deletions
|
@ -8,7 +8,6 @@ services:
|
|||
context: .
|
||||
target: bot
|
||||
restart: unless-stopped
|
||||
user: 1000:1000
|
||||
depends_on:
|
||||
- db
|
||||
- migration
|
||||
|
@ -22,7 +21,6 @@ services:
|
|||
context: .
|
||||
target: web
|
||||
restart: unless-stopped
|
||||
user: 1000:1000
|
||||
depends_on:
|
||||
- db
|
||||
- migration
|
||||
|
@ -37,7 +35,6 @@ services:
|
|||
dockerfile: Containerfile
|
||||
context: .
|
||||
target: migration
|
||||
user: 1000:1000
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.zaxxer.hikari.HikariConfig;
|
|||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import de.hhhammer.dchat.db.ServerDBService;
|
||||
import de.hhhammer.dchat.db.UserDBService;
|
||||
import io.javalin.Javalin;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -29,6 +30,9 @@ public class App {
|
|||
config.setJdbcUrl(postgresUrl);
|
||||
config.setUsername(postgresUser);
|
||||
config.setPassword(postgresPassword);
|
||||
config.addDataSourceProperty("cachePrepStmts", "true");
|
||||
config.addDataSourceProperty("prepStmtCacheSize", "250");
|
||||
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
||||
|
||||
try (var ds = new HikariDataSource(config)) {
|
||||
var serverDBService = new ServerDBService(ds);
|
||||
|
|
|
@ -10,9 +10,6 @@ import io.javalin.http.staticfiles.Location;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static io.javalin.apibuilder.ApiBuilder.crud;
|
||||
import static io.javalin.apibuilder.ApiBuilder.path;
|
||||
|
||||
|
@ -41,12 +38,9 @@ public class WebAPI implements Runnable {
|
|||
staticFileConfig.directory = "ui";
|
||||
});
|
||||
});
|
||||
var waitForShutdown = new CompletableFuture<Void>();
|
||||
Runtime.getRuntime().addShutdownHook(Thread.ofVirtual().name("javalin-shutdown").unstarted(() -> {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
logger.info("Shutting down web application");
|
||||
app.stop();
|
||||
waitForShutdown.complete(null);
|
||||
|
||||
}));
|
||||
app.events(event -> {
|
||||
event.serverStopping(() -> logger.info("Stopping web service"));
|
||||
|
@ -75,10 +69,5 @@ public class WebAPI implements Runnable {
|
|||
});
|
||||
|
||||
app.start(this.port);
|
||||
try {
|
||||
waitForShutdown.get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue