WF DelayActivity 立即触发?
我创建了一个工作流程并将其部署到 Sharepoint 2007 场。当它与一个项目发生两个延迟活动时,我立即引发了火灾。
我已经在 InitializeTimeoutDuration 事件上设置了回调。通过日志和调试输出,我可以看到它将延迟设置为一小时。但是,在下一个 SP 计时器作业周期(少于 5 分钟),将触发进行延迟活动的事件。
我在这里迷路了。非常感谢任何帮助。
更新
通过一些挖掘,我能够确定为什么会发生这种情况。工作流启动后,一条记录将添加到 SP 内容数据库中的 ScheduledWorkItems 表中。但是,记录上的“DeliveryDate”设置为当前时间,而“Created”日期设置为一小时前。然而,我使用的延迟是 2 小时,所以这两个时间对我来说根本没有意义。尝试对其进行硬编码...
更新 2
即使有硬编码的持续时间,时间也会关闭。我硬编码了 2 小时的延迟,“DeliveryDate”现在是未来一小时,而“Created”日期是过去一小时。所以至少他们之间的区别是好的。
更新
好吧,这很尴尬...发现了问题。我将其发布在这里是为了其他可能像我一样犯错误的人。首先,我的 UTC-> 本地转换不正确。数据库上的时间是正确的。不正确的是我设置 TimeoutDuration 的方式:
// WRONG!
delayActivity.TimeoutDuration = new TimeSpan("1:00:00"); // one hour
我应该做什么:
// RIGHT!
((DelayActivity)sender).TimeoutDuration = new TimeSpan("1:00:00"); // one hour
一旦我进行了更改,其他一切似乎都很好。
I have a Workflow I have created and deployed to a Sharepoint 2007 farm. When it runs against an item two delay activities I have created fire immediately.
I have setup a callback on the InitializeTimeoutDuration event. Through logs and debug output I can see that it is setting the delay to one hour. However, at the next SP timer job cycle (less than 5 minutes) the events proceeding the Delay activity fire off.
I'm lost here. Any help is greatly appreciated.
Update
Through some digging I was able to determine why this was firing off. Once the workflow started a record gets added to the ScheduledWorkItems table in the SP Content database. However, the "DeliveryDate" on the record is set to the current time while the "Created" date is set to one hour previous. However, the delay I'm using is 2 hours, so neither of these times make sense to me at all. Going to try hardcoding it....
Update 2
Even with a hardcoded duration the times are off. I hardcoded a 2 hour delay in and the "DeliveryDate" is now one hour in the future while the "Created" date is one hour in the past. So at least the difference between them is good.
Update
Well, that's embarrassing... found the problem. I'm posting it in here for others that may make mistakes like I do. First off, I was not correct in my UTC->local conversion. The times on the database were correct. What was not correct was how I was setting the TimeoutDuration:
// WRONG!
delayActivity.TimeoutDuration = new TimeSpan("1:00:00"); // one hour
what I should have been doing:
// RIGHT!
((DelayActivity)sender).TimeoutDuration = new TimeSpan("1:00:00"); // one hour
once I made that change everything else seems to be fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,那就尴尬了……发现问题了。我将其发布在这里是为了其他可能像我一样犯错误的人。首先,我的 UTC-> 本地转换不正确。数据库上的时间是正确的。不正确的是我设置 TimeoutDuration 的方式:
// 错误!
delayActivity.TimeoutDuration = new TimeSpan("1:00:00"); // 一小时
我应该做的事情:
// 对!
((DelayActivity)sender).TimeoutDuration = new TimeSpan("1:00:00"); // 一小时
后,我做了这个改变,其他一切似乎都很好。
Well, that's embarassing... found the problem. I'm posting it in here for others that may make mistakes like I do. First off, I was not correct in my UTC->local conversion. The times on the database were correct. What was not correct was how I was setting the TimeoutDuration:
// WRONG!
delayActivity.TimeoutDuration = new TimeSpan("1:00:00"); // one hour
what I should have been doing:
// RIGHT!
((DelayActivity)sender).TimeoutDuration = new TimeSpan("1:00:00"); // one hour
once I made that change everything else seems to be fine.