@@ -284,12 +284,16 @@ public static bool WriteHash(string Hash, string Data, string Collection)
284
284
}
285
285
}
286
286
287
- if ( UseFileStore )
287
+ if ( UseFileStore ) //in case if Redis and FileStore
288
288
{
289
+ if ( ! Directory . Exists ( Path . Combine ( FilePath , Collection ) ) )
290
+ Directory . CreateDirectory ( Path . Combine ( FilePath , Collection ) ) ;
289
291
292
+ if ( ! File . Exists ( Path . Combine ( FilePath , Collection , Hash + ".json" ) ) ) //We do not have to create the same hash file twice...
290
293
{
291
294
lock ( locker ) //only one write operation
292
295
{
296
+ File . WriteAllText ( Path . Combine ( FilePath , Collection , Hash + ".json" ) , Data ) ;
293
297
}
294
298
}
295
299
}
@@ -492,6 +496,7 @@ public static bool WriteHash(string Hash, string Data, string Collection)
492
496
}
493
497
catch ( Exception ex )
494
498
{
499
+ Debug . WriteLine ( ex . Message ) ;
495
500
if ( ! Directory . Exists ( Path . Combine ( FilePath , Collection ) ) )
496
501
Directory . CreateDirectory ( Path . Combine ( FilePath , Collection ) ) ;
497
502
@@ -1146,7 +1151,7 @@ public static JObject GetFull(string DeviceID, int Index = -1, string blockType
1146
1151
if ( Index == - 1 )
1147
1152
{
1148
1153
//Cache Full
1149
- WriteHashAsync ( DeviceID , oInv . ToString ( ) , "_full" ) ;
1154
+ WriteHashAsync ( DeviceID , oInv . ToString ( ) , "_full" ) . ConfigureAwait ( false ) ;
1150
1155
}
1151
1156
1152
1157
/*var cacheEntryOptions = new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(60)); //cache full for 60s
0 commit comments