mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Use virtual threads.
This commit is contained in:
parent
b3fd4f2ce9
commit
52229ed8c7
2 changed files with 3 additions and 3 deletions
|
@ -53,11 +53,11 @@ public class Main {
|
|||
System.exit(1);
|
||||
}
|
||||
|
||||
Multithreading.runAsync(() -> new Thread(new SyncRunner(
|
||||
Multithreading.runAsync(() -> Thread.ofVirtual().start(new SyncRunner(
|
||||
new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build(),
|
||||
MATRIX_SERVER,
|
||||
MatrixHelper.MATRIX_TOKEN)
|
||||
).start());
|
||||
));
|
||||
|
||||
new Timer().scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.function.Supplier;
|
|||
|
||||
public class Multithreading {
|
||||
|
||||
private static final ExecutorService es = Executors.newCachedThreadPool();
|
||||
private static final ExecutorService es = Executors.newVirtualThreadPerTaskExecutor();
|
||||
private static final ExecutorService esLimited = Executors
|
||||
.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 8);
|
||||
private static final ExecutorService esLimitedPubSub = Executors
|
||||
|
|
Loading…
Reference in a new issue