File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
Tools/AutoClient/Modes/FolderStore Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public void Run(CancellationTokenSource cts)
28
28
var folderFiles = Directory . GetFiles ( app . Config . FolderToStore ) ;
29
29
if ( ! folderFiles . Any ( ) ) throw new Exception ( "No files found in " + app . Config . FolderToStore ) ;
30
30
31
- changeCounter = 0 ;
31
+ var saveFolderJsonCounter = 0 ;
32
32
balanceChecker . Check ( ) ;
33
33
foreach ( var folderFile in folderFiles )
34
34
{
@@ -39,18 +39,28 @@ public void Run(CancellationTokenSource cts)
39
39
SaveFile ( folderFile ) ;
40
40
}
41
41
42
- if ( failureCount > 9 )
42
+ if ( failureCount > 3 )
43
43
{
44
44
app . Log . Error ( "Failure count reached threshold. Stopping..." ) ;
45
45
cts . Cancel ( ) ;
46
46
return ;
47
47
}
48
48
49
- if ( changeCounter > 5 )
49
+ if ( changeCounter > 1 )
50
50
{
51
51
changeCounter = 0 ;
52
- balanceChecker . Check ( ) ;
53
- SaveFolderSaverJsonFile ( ) ;
52
+ saveFolderJsonCounter ++ ;
53
+ if ( saveFolderJsonCounter > 5 )
54
+ {
55
+ saveFolderJsonCounter = 0 ;
56
+ if ( failureCount > 0 )
57
+ {
58
+ app . Log . Log ( $ "Failure count is reset. (Was: { failureCount } )") ;
59
+ failureCount = 0 ;
60
+ }
61
+ balanceChecker . Check ( ) ;
62
+ SaveFolderSaverJsonFile ( ) ;
63
+ }
54
64
}
55
65
56
66
statusFile . Save ( status ) ;
You can’t perform that action at this time.
0 commit comments