Giter Club home page Giter Club logo

Comments (5)

spinettaro avatar spinettaro commented on June 15, 2024

Hi @dalijap that is a good point. One additional check can be before the method invoke to check if the Subscriber is not nil:

if not Assigned( ASubscription.Subscriber) then
      Exit;
if not ASubscription.Active then
      Exit;

Other than that we could also think about a callback in case of exception. Because as you can see from the method below the exception will be handled:

  try
    if not ASubscription.Active then
      Exit;

    ASubscription.SubscriberMethod.Method.Invoke(ASubscription.Subscriber, Args);
  except
    on E: Exception do begin
      raise EInvokeSubscriberError.CreateFmt(
        'Error invoking subscriber method. Subscriber class: %s. Event type: %s. Original exception %s: %s.',
        [
          ASubscription.Subscriber.ClassName,
          ASubscription.SubscriberMethod.EventType,
          E.ClassName,
          E.Message
        ]);
    end;
  end;

Then also around the crash, it would be limited to the single thread/task.

We can also think to change the Subscription into an interface.

What do you think? do you have additional suggestions for the issue?

Thanks :)

from delphi-event-bus.

spinettaro avatar spinettaro commented on June 15, 2024

here a PR #65

from delphi-event-bus.

dkounal avatar dkounal commented on June 15, 2024

Using the last change #65 that was proposed by @spinettaro in a production application that does not have a heavy use of Teventbus, and with TEurekalog enabled to send me messages when application freezes for more than 10sec, I get occasionally a log event like the following:
2021-05-05_12-02-46

from delphi-event-bus.

spinettaro avatar spinettaro commented on June 15, 2024

HI @dkounal do you mean there is a freeze now? Do you see a difference with a previous version of DEB (before #65)? Is the freeze time the second column from the right?

from delphi-event-bus.

dkounal avatar dkounal commented on June 15, 2024

To be honest, it is difficult to compare with before #65, as I had many changes in the code and a bug fix in a component that was used by after Teventmessage comes.
Teurekalog has a function where you can request to log when an application UI freezes and have also the callstack. I have put a 10seconds timeframe to log for freezing
Their call stack list is not so accurate to say when the app is freezed. But before classes from Eurekalog appear in the above image's stack list, it is a Teventbus in action that exists in the call stack.
In the past I had messages like the above, I think more frequently with the previous version of Teventbus.
I am not so experienced and I posted if it helps somehow. I will keep following to grab a more helpful message.

from delphi-event-bus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.