简体   繁体   English

果园后台任务

[英]Orchard Background tasks

I ve been wondering does orchard create a new thread each time it sweeps after 60 secondes ? 我一直想知道果园是否在60秒后每次扫描都创建一个新线程?

lets say for instance you have a background task which can be multiple tasks that we'll iterate : 例如,假设您有一个后台任务,该任务可以是我们将要迭代的多个任务:

public class MyBackGroundTask : IBackgroundTask
{
    public void Sweep()
    {
        var AwaitingTasks = _TasksServices.GetAwaitingTasks();
        foreach(var awaitingTask in AwaitingTasks)
        {
            // do something 
        }
    }
}

those tasks can take up to 30 minutes for example . 例如,这些任务最多可能需要30分钟。 does orchard creates a new thread for the Sweep() after one minute or he'll wait for the previous executed task to end ? 果园在一分钟后是否为Sweep()创建新线程,否则他将等待先前执行的任务结束?

if so is there any good approach i can take to create a good queuing system ? 如果可以的话,是否有什么好的方法可以创建一个好的排队系统?

thanks in advance 提前致谢

Orchard has a processing engine that allows you to delay processing of a long running task to a background thread, which may be more what you are after? Orchard具有一个处理引擎,可让您将长时间运行的任务的处理延迟到后台线程,这可能是您所追求的吗?

Have look in the comments module, the CommentsService has a method called process comment count which should serve as a good example of how the processing engine works. 看一下comment模块,CommentsService有一个称为过程注释计数的方法,该方法应作为处理引擎如何工作的一个很好的例子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM