Fix overlap when sync is still running, fix directory guid not changing
This commit is contained in:
parent
16dba7bdcd
commit
134a4642b2
@ -29,7 +29,7 @@ Public MustInherit Class BaseModule
|
||||
Public Event OnFileProcessed As EventHandler(Of String) Implements ISync.OnFileProcessed
|
||||
Public Event OnFileError As EventHandler(Of String) Implements ISync.OnFileError
|
||||
|
||||
Private ReadOnly DirectoryGuid As String = Guid.NewGuid.ToString()
|
||||
Private DirectoryGuid As String = Guid.NewGuid.ToString()
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pConfig As Config)
|
||||
MyBase.New(pLogConfig)
|
||||
@ -38,6 +38,10 @@ Public MustInherit Class BaseModule
|
||||
Config = pConfig
|
||||
End Sub
|
||||
|
||||
Friend Sub RefreshDirectoryGuid()
|
||||
DirectoryGuid = Guid.NewGuid.ToString()
|
||||
End Sub
|
||||
|
||||
Friend Async Function FetchDocIds() As Task(Of List(Of String))
|
||||
If Config.SQLQueryFetch = "" Then
|
||||
Logger.Warn("Fetch Query is not configured. Exiting.")
|
||||
|
||||
@ -20,6 +20,7 @@ Namespace Sharepoint
|
||||
AddDivider()
|
||||
|
||||
EnsureOutputDirectoryExists()
|
||||
RefreshDirectoryGuid()
|
||||
|
||||
Dim oExtDocIds = Await FetchDocIds()
|
||||
If oExtDocIds Is Nothing Then
|
||||
|
||||
@ -32,6 +32,7 @@ Namespace slt
|
||||
AddDivider()
|
||||
|
||||
EnsureOutputDirectoryExists()
|
||||
RefreshDirectoryGuid()
|
||||
|
||||
Dim oExtDocIds = Await FetchDocIds()
|
||||
If oExtDocIds Is Nothing Then
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.Runtime.Remoting.Messaging
|
||||
Imports System.Threading.Tasks
|
||||
Imports Connectors.Common
|
||||
Imports DevExpress.XtraEditors.ViewInfo
|
||||
Imports DigitalData.Modules.Config
|
||||
@ -15,6 +16,7 @@ Partial Public Class frmMain
|
||||
|
||||
Private FilesProcessed As Integer = 0
|
||||
Private ErrorsOccurred As Integer = 0
|
||||
Private SyncRunning As Boolean = False
|
||||
|
||||
Public Enum LogLevel
|
||||
Info
|
||||
@ -48,7 +50,7 @@ Partial Public Class frmMain
|
||||
AddDivider()
|
||||
|
||||
If ConfigManager.Config.ActiveModule = "NONE" Then
|
||||
AddWarnEntry("No ActiveModule selected, check your configuration!", ConfigManager.Config.ActiveModule)
|
||||
AddWarnEntry("No ActiveModule selected, check your configuration!")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
@ -69,11 +71,16 @@ Partial Public Class frmMain
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Sync.TestConfigIsComplete() Then
|
||||
AddWarnEntry("Configuration is incomplete, check your configuration!")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
btnForceSync.Enabled = True
|
||||
|
||||
If ConfigManager.Config.Autostart And Sync.TestConfigIsComplete() Then
|
||||
If ConfigManager.Config.Autostart Then
|
||||
btnForceSync.Enabled = False
|
||||
Await Sync.Run()
|
||||
Await RunSync()
|
||||
btnForceSync.Enabled = True
|
||||
End If
|
||||
|
||||
@ -165,9 +172,26 @@ Partial Public Class frmMain
|
||||
SyncTimer.Enabled = False
|
||||
End Sub
|
||||
|
||||
Private Async Function RunSync() As Task
|
||||
If SyncRunning = True Then
|
||||
Logger.Debug("Sync still running. Skipping.")
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
Try
|
||||
SyncRunning = True
|
||||
Await Sync.Run()
|
||||
SyncRunning = False
|
||||
Catch ex As Exception
|
||||
SyncRunning = False
|
||||
Logger.Warn("Error while running sync!")
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Async Function Timer_Elapsed(sender As Object, e As System.EventArgs) As Threading.Tasks.Task Handles SyncTimer.Tick
|
||||
btnForceSync.Enabled = False
|
||||
Await Sync.Run()
|
||||
Await RunSync()
|
||||
btnForceSync.Enabled = True
|
||||
End Function
|
||||
|
||||
@ -253,7 +277,7 @@ Partial Public Class frmMain
|
||||
|
||||
Private Async Sub btnForceSync_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnForceSync.ItemClick
|
||||
btnForceSync.Enabled = False
|
||||
Await Sync.Run()
|
||||
Await RunSync()
|
||||
btnForceSync.Enabled = True
|
||||
End Sub
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user