Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy works even when is disabled!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Strategy works even when is disabled!

    I am developing a strategy that makes use of Firebase, I have done the connection tests and everything works fine, the problem comes when disabling the strategy, it continues to work.

    I have tried many ways, the "exec" variable is bool, I have tried with int, I have tried the "IsEnabled" and I have not had results, "ListenerUpdate ()" still works even when the "if # 1" is true. Why does this happen? Why does it enter the "if # 1" conditional even when it works and the strategy is disabled?

    Another problem is that when I re-enable the strategy, it now works double, if I disable and enable the strategy 5 times, I will have 5 processes in parallel, with 5 queries. Ninja does not kill the above process, "ListenerUpdate ()" runs in parallel the number of times you disable and enable the strategy. Why does that happen?

    Click image for larger version

Name:	Captura 16.PNG
Views:	149
Size:	36.0 KB
ID:	1160326

    #2
    Hello GonzalesDevelop,

    Thank you for the post.

    While our support for third party libraries is very limited I can try to make some suggestions based on the details provided.

    You will need to review the documentation for the library you are using to see if there is a subscribe/unsubscribe pattern that you can use. The code you have shown is called in State.Configure however when you stop the strategy State.Terminated will be called and Configure will not be called again.

    If the library you are using can make an event handler subscription then you could use Terminated to unsubscribe from the event and close the client/do any shut down work needed for that library.

    Generally subscribing and unsubscribing to an event looks like:

    Code:
    client.MyEventName += MyEventVoidMethod;
    unsubscribing looks like:

    Code:
    client.MyEventName +- MyEventVoidMethod;
    If the library does not have that type of pattern you would need to instead research their documentation to see if there is a specific way to shut down that client object you have shown. You would need to store a class level variable for that and then use State.Terminated to shut down the client.

    Please let me know if I may be of additional assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    39 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    124 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    64 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X