Skip to content

State disposed during inboxFn when asked #46

@StefanBertels

Description

@StefanBertels

Issue similar to #42 but when actor is asked.

Can be reproduced with:

using System.Reactive.Disposables;

var actor2 = spawn<BooleanDisposable, long>("actor2", () => new BooleanDisposable(), (state, msg) =>
                {
                    using (observeUnsafe<Unit>(Self).Subscribe(_ => { }, () => { Console.WriteLine("subject completed in actor2"); }))
                    {
                        Console.WriteLine($"actor2: Processing msg: {msg}, state.IsDisposed={state.IsDisposed}");
                        Task.Delay(5 * seconds).Wait();
                        reply("Answer from actor2");
                        Console.WriteLine($"actor2: Answered and finished processing msg: {msg}, state.IsDisposed={state.IsDisposed}");
                    }


                    return state;
                });

                //ASK
                Observable.Timer(1 * seconds).Subscribe(_ =>
                {
                    Console.WriteLine($"Telling actor2 msg: {_}");
                    var answer = ask<string>(actor2, _);
                    Console.WriteLine($"Answer from actor2: {answer}");
                });

                Observable.Timer(2 * seconds).Subscribe(_ =>
                {
                    Console.WriteLine("Killing actor2...");
                    kill(actor2);
                    Console.WriteLine("Killed actor2...");
                });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions