Dont execute folderwatch functions when indexing is active

This commit is contained in:
Jonathan Jenne 2020-02-11 15:55:55 +01:00
parent ad43903875
commit 1fbfa0b1ee
3 changed files with 14 additions and 0 deletions

View File

@ -57,6 +57,7 @@ Module ModuleCURRENT
Public CURRENT_HTML_DOC As String
Public INDEXING_ACTIVE As Boolean = False
Public MULTIINDEXING_ACTIVE As Boolean = False
Public ABORT_INDEXING As Boolean = False

View File

@ -1250,6 +1250,8 @@ Public Class frmIndex
End Sub
Private Sub frmIndex_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Try
INDEXING_ACTIVE = False
' This prevents the thread issue when the form containing the viewer is opened via ShowDialog.
DocumentViewer1.Done()
@ -1265,6 +1267,8 @@ Public Class frmIndex
' Abbruchzähler zurücksetzen
CancelAttempts = 0
INDEXING_ACTIVE = True
Try
CURRENT_ISATTACHMENT = False
DropType = ClassDatabase.Execute_Scalar("SELECT HANDLE_TYPE FROM TBGI_FILES_USER WHERE GUID = " & CURRENT_WORKFILE_GUID, MyConnectionString, True)

View File

@ -633,6 +633,14 @@ Public Class frmStart
End If
Else
Try
' JenneJ, 11.02.2019:
' Keine Folderwatch Dateien verarbeiten, wenn gerade Indexiert wird,
' dadurch würden die Globalen Variablen überschrieben
' und in Folge die falschen Dateien Indexiert!
If INDEXING_ACTIVE Or MULTIINDEXING_ACTIVE Then
Exit Sub
End If
If FW_started = True Or CONFIG.Config.FolderWatchScanStarted = True Then
'Prüfen ob alle Files abgearbeitet wurden
Dim sql = "SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND HANDLE_TYPE like '%|FW%' AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')"
@ -780,4 +788,5 @@ Public Class frmStart
End Try
End Sub
End Class