mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-12-13 13:50:28 +05:30
Use virtual threads.
This commit is contained in:
parent
b3fd4f2ce9
commit
52229ed8c7
@ -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 New Issue
Block a user