Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when "closing" a time interval #52

Closed
caxelrud opened this issue May 27, 2024 · 1 comment
Closed

Error when "closing" a time interval #52

caxelrud opened this issue May 27, 2024 · 1 comment

Comments

@caxelrud
Copy link

I am getting the following error:

source = interval(10000)
close(source) 
ERROR: MethodError: no method matching close(::TimerObservable{Int64})
@bvdmitri
Copy link
Member

The close function is not (and should not be) implemented for interval because there is nothing to close initially. The interval only starts when you call subscribe!

source = interval(10000)

This line merely sets up the data structure needed for subscribe!. The interval begins with the following line:

subscription = subscribe!(source, logger()) # starts the interval

You can then use unsubscribe! to stop the interval, which will automatically call close:

unsubscribe!(subscription)  # Automatically closes the interval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants