mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2025-04-29 00:10:31 +05:30
Use virtual threads.
This commit is contained in:
parent
b3fd4f2ce9
commit
52229ed8c7
@ -53,11 +53,11 @@ public class Main {
|
|||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Multithreading.runAsync(() -> new Thread(new SyncRunner(
|
Multithreading.runAsync(() -> Thread.ofVirtual().start(new SyncRunner(
|
||||||
new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build(),
|
new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build(),
|
||||||
MATRIX_SERVER,
|
MATRIX_SERVER,
|
||||||
MatrixHelper.MATRIX_TOKEN)
|
MatrixHelper.MATRIX_TOKEN)
|
||||||
).start());
|
));
|
||||||
|
|
||||||
new Timer().scheduleAtFixedRate(new TimerTask() {
|
new Timer().scheduleAtFixedRate(new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,7 +5,7 @@ import java.util.function.Supplier;
|
|||||||
|
|
||||||
public class Multithreading {
|
public class Multithreading {
|
||||||
|
|
||||||
private static final ExecutorService es = Executors.newCachedThreadPool();
|
private static final ExecutorService es = Executors.newVirtualThreadPerTaskExecutor();
|
||||||
private static final ExecutorService esLimited = Executors
|
private static final ExecutorService esLimited = Executors
|
||||||
.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 8);
|
.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 8);
|
||||||
private static final ExecutorService esLimitedPubSub = Executors
|
private static final ExecutorService esLimitedPubSub = Executors
|
||||||
|
Loading…
x
Reference in New Issue
Block a user