【发布时间】:2021-05-27 18:17:27
【问题描述】:
朋友们:这个问题让我很困惑。
除非我记录,否则此代码会两次提交相同的作业!
' optionally log to a textfile before call
If bLog Then LogProcess("Before run")
' this only processes once regardless of
ExecuteSQL($"UPDATE [Process] SET [timesRepeated] += 1, [dateStarted] = '{Now}' WHERE [id] = {iID}")
Dim oBackground As New Background
' this thing spawns two of the some - but not all - jobs!
Dim t1 As Task = Task.Run(Sub() CallByName(oBackground, sProcessKey, CallType.Method, iID))
' optionally log to a textfile following call
If bLog Then LogProcess("After run")
这发生在由内部计时器调用的后台处理例程中。
我已经验证了计时器只产生一次,并且每次“heatbeat”只触发一次。
如果使用 bLog = True 调用此例程,我会执行单次执行。如果 bLog = False,某些进程 (sProcessKey) 会同时被调用两次。我也登录了这些例程。
有什么想法吗?
提前致谢。
【问题讨论】:
标签: process background task callbyname