Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8799158

Browse files
committed
只要Close就重置写入器
1 parent 2d24f7f commit 8799158

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

csharp/QuantBox.Data.Serializer/V2/TickWriter.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public void Close()
4545
{
4646
lock(locker)
4747
{
48+
Serializer.Reset();
49+
4850
if (Stream == null)
4951
return;
5052

@@ -62,9 +64,10 @@ public void Write()
6264

6365
if (Stream == null)
6466
{
65-
Stream = File.Open(FullPath, FileMode.Append, FileAccess.Write, FileShare.Read);
6667
// 换天时,必须重置记录器,不然记录的数据是差分后数据,导致新文件无法解读
6768
Serializer.Reset();
69+
70+
Stream = File.Open(FullPath, FileMode.Append, FileAccess.Write, FileShare.Read);
6871
}
6972

7073
Serializer.Write(Tick, Stream);

0 commit comments

Comments
 (0)