-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed problem with R-instat start up #9049
Fixed problem with R-instat start up #9049
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@N-thony I don't see what I can check here, as it now doesn't show on my machine anyway. So I am approving and leaving the check to you
instat/frmMain.vb
Outdated
If Directory.Exists(strAutoSaveDataFolderPath) OrElse Directory.Exists(strAutoSaveLogFolderPath) OrElse Directory.Exists(strAutoSaveInternalLogFolderPath) Then | ||
' Define the retention policy (keep last N autosaves) | ||
Dim retentionCount As Integer = 5 ' Example: Keep the last 5 autosaves | ||
|
||
' Retrieve autosaved files | ||
If Directory.Exists(strAutoSaveDataFolderPath) Then | ||
Dim autoSaveDirectory As New DirectoryInfo(strAutoSaveDataFolderPath) | ||
Dim files As FileInfo() = autoSaveDirectory.GetFiles("data_*.rds") ' Adjust pattern to match actual filenames | ||
|
||
' Sort files by last write time in descending order | ||
Dim sortedFiles As IOrderedEnumerable(Of FileInfo) = files.OrderByDescending(Function(f) f.LastWriteTime) | ||
|
||
' Determine files to delete based on retention policy | ||
Dim filesToDelete As IEnumerable(Of FileInfo) = sortedFiles.Skip(retentionCount) | ||
|
||
' Delete older autosaved files | ||
For Each file In filesToDelete | ||
file.Delete() | ||
Next | ||
ElseIf Directory.Exists(strAutoSaveLogFolderPath) Then | ||
Dim autoSaveDirectory As New DirectoryInfo(strAutoSaveLogFolderPath) | ||
Dim files As FileInfo() = autoSaveDirectory.GetFiles("log*.R") ' Adjust pattern to match actual filenames | ||
|
||
' Sort files by last write time in descending order | ||
Dim sortedFiles As IOrderedEnumerable(Of FileInfo) = files.OrderByDescending(Function(f) f.LastWriteTime) | ||
|
||
' Determine files to delete based on retention policy | ||
Dim filesToDelete As IEnumerable(Of FileInfo) = sortedFiles.Skip(retentionCount) | ||
|
||
' Delete older autosaved files | ||
For Each file In filesToDelete | ||
file.Delete() | ||
Next | ||
ElseIf Directory.Exists(strAutoSaveInternalLogFolderPath) Then | ||
Dim autoSaveDirectory As New DirectoryInfo(strAutoSaveInternalLogFolderPath) | ||
Dim files As FileInfo() = autoSaveDirectory.GetFiles("debug_log*.R") ' Adjust pattern to match actual filenames | ||
|
||
' Sort files by last write time in descending order | ||
Dim sortedFiles As IOrderedEnumerable(Of FileInfo) = files.OrderByDescending(Function(f) f.LastWriteTime) | ||
|
||
' Determine files to delete based on retention policy | ||
Dim filesToDelete As IEnumerable(Of FileInfo) = sortedFiles.Skip(retentionCount) | ||
|
||
' Delete older autosaved files | ||
For Each file In filesToDelete | ||
file.Delete() | ||
Next | ||
End If | ||
End If | ||
Catch ex As Exception | ||
MsgBox("Could not delete auto save data file at: " & strCurrentAutoSaveDataFilePath & Environment.NewLine & ex.Message) | ||
End Try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@derekagorhom I don't think the problem was with the retention, because we need the auto saved files when it comes to recovery.
I think this is the message @rdstern doesn't want, but I still get it after running this branch
@rdstern @derekagorhom we are no longer deleting the backup files. The message was to check if R-Instat has previously crushed. So, with the new change made in the code, I created a new file called |
fix auto recovery
Update branch
Backup changes
@N-thony Thanks for this, I have pulled the changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am simply approving
Fixes #9042
@rdstern , @N-thony this PR is ready for review