简体   繁体   English

Azure Service Fabric - 使用自定义服务删除Actor

[英]Azure Service Fabric - Delete Actor with custom Service

I'm having hard times with Actor delete. 我正在玩Actor删除困难。 I've created custom base service to enable backup on my Actor System bu unfortunately having Task.Delay() inside RunAsync forbid me from actor delete (DeleteActorAsync hangs). 我已经创建了自定义基本服务以在我的Actor系统上启用备份,不幸的是在RunAsync中有Task.Delay()禁止我从actor删除(DeleteActorAsync挂起)。

My RunAsync in custom service have simple construction: 自定义服务中的RunAsync具有简单的构造:

protected override async Task RunAsync(CancellationToken cancellationToken)
{
    await Task.Delay(500, cancellationToken);
}

That's it. 而已。 When I remove delay and replace with standard base.RunAsync() actor delete runs with no problems. 当我删除延迟并替换为标准base.RunAsync()actor运行没有问题。

Can anybody suggest something? 任何人都可以提出建议吗? I'm unable to find anything usable in documentation. 我无法在文档中找到任何可用的东西。

I've managed to find issue in ActorService source code (although it was already in code remarks of ActorService.RunAsync()). 我已经设法在ActorService源代码中找到问题(虽然它已经在ActorService.RunAsync()的代码备注中)。

You have to run base.RunAsync(...) if you override this in custom implementation :) 如果在自定义实现中覆盖它,则必须运行base.RunAsync(...):)

protected override async Task RunAsync(CancellationToken cancellationToken)
{
    await base.RunAsync(cancellationToken);
    await Task.Delay(500, cancellationToken);
}

That's all. 就这样。 Everything now works perfectly! 现在一切都很完美!

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

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