WF DelayActivity 立即触发? [英] WF DelayActivity fires immediately?

查看:69
本文介绍了WF DelayActivity 立即触发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个工作流并部署到 Sharepoint 2007 场.当它针对一个项目运行时,我立即引发了两个延迟活动.

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.

我在 InitializeTimeoutDuration 事件上设置了回调.通过日志和调试输出,我可以看到它将延迟设置为一小时.但是,在下一个 SP 计时器作业周期(少于 5 分钟)中,将触发延迟活动的事件.

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.

更新

通过一些挖掘,我能够确定为什么会这样.工作流启动后,一条记录将添加到 SP 内容数据库的 ScheduledWorkItems 表中.但是,记录上的DeliveryDate"设置为当前时间,而Created"日期设置为一小时前.但是,我使用的延迟是 2 小时,所以这两个时间对我来说都没有意义.打算尝试对其进行硬编码....

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....

更新 2

即使使用硬编码的持续时间,时间也会关闭.我硬编码了 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.

更新

好吧,这很尴尬……找到了问题所在.我把它贴在这里是为了其他可能会像我一样犯错的人.首先,我的 UTC-> 本地转换不正确.数据库上的时间是正确的.不正确的是我设置 TimeoutDuration 的方式:

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

我应该做什么:

// RIGHT!
((DelayActivity)sender).TimeoutDuration = new TimeSpan("1:00:00"); // one hour

一旦我做了那个改变,其他一切似乎都很好.

once I made that change everything else seems to be fine.

推荐答案

好吧,那太尴尬了……找到问题了.我把它贴在这里是为了其他可能会像我一样犯错的人.首先,我的 UTC-> 本地转换不正确.数据库上的时间是正确的.不正确的是我设置 TimeoutDuration 的方式:

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:

//错了!delayActivity.TimeoutDuration = new TimeSpan("1:00:00");//一小时

// WRONG! delayActivity.TimeoutDuration = new TimeSpan("1:00:00"); // one hour

我应该做什么:

//没错!((DelayActivity)sender).TimeoutDuration = new TimeSpan("1:00:00");//一小时

// RIGHT! ((DelayActivity)sender).TimeoutDuration = new TimeSpan("1:00:00"); // one hour

一旦我做了那个改变,其他一切似乎都很好.

once I made that change everything else seems to be fine.

这篇关于WF DelayActivity 立即触发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆