mirror of
https://github.com/Geniusay/ChopperBot.git
synced 2026-07-01 02:04:35 +08:00
FileCacheBug
This commit is contained in:
@@ -39,5 +39,9 @@ public class Test {
|
||||
System.out.println(dsmTask + "(运行状态):" + manager.isTaskRunning(dsmTask));
|
||||
System.out.println(dsmTask + "(缓存中弹幕条数):" + manager.getCacheSize(dsmTask));
|
||||
}
|
||||
|
||||
while(true){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,8 +32,7 @@ public class PipelineWriteJson implements Pipeline {
|
||||
this.loadConfig = loadConfig;
|
||||
this.cache = new ConcurrentLinkedQueue<>();
|
||||
this.barrageSaveFile = new BarrageSaveFile(loadConfig, cache);
|
||||
this.filecache = new FileCache(barrageSaveFile);
|
||||
FileCacheManagerInstance.getInstance().addFileCache(filecache);
|
||||
this.filecache = new FileCache(barrageSaveFile,0,10*1024);
|
||||
} catch (FileCacheException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -57,7 +56,9 @@ public class PipelineWriteJson implements Pipeline {
|
||||
|
||||
Barrage barrage;
|
||||
while ((barrage = cache.poll()) != null) {
|
||||
System.out.print("写入:" + successCount);
|
||||
if(successCount%1000==0){
|
||||
System.out.print("写入:" + successCount);
|
||||
}
|
||||
try {
|
||||
filecache.append(barrage, "-1");
|
||||
} catch (InterruptedException | FileCacheException e) {
|
||||
@@ -65,7 +66,7 @@ public class PipelineWriteJson implements Pipeline {
|
||||
}
|
||||
successCount++;
|
||||
}
|
||||
|
||||
filecache.forceSync();
|
||||
return successCount;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,10 +45,13 @@ public class BarrageSaveFile extends ConfigFile<ConcurrentLinkedQueue<Barrage>>
|
||||
setFileName(fileName);
|
||||
String rootPath = Paths.get(BARRAGE_ROOT, loadConfig.getAnchorName()).toString(); //获取当前主播的文件夹路径
|
||||
setFilePath(rootPath);
|
||||
|
||||
Path path = Path.of(rootPath);
|
||||
//TODO 待移除 建立主播文件夹
|
||||
try {
|
||||
Files.createDirectory(Path.of(rootPath));
|
||||
if(!Files.exists(path)){
|
||||
Files.createDirectory(path);
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user