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

A bug when I call thetimeout function multiple times #30

Open
chanyyyy opened this issue Feb 24, 2023 · 3 comments
Open

A bug when I call thetimeout function multiple times #30

chanyyyy opened this issue Feb 24, 2023 · 3 comments

Comments

@chanyyyy
Copy link

No description provided.

@chanyyyy
Copy link
Author

After one time out call, the other calls which shouldn't timeout end to raise the Functiontimeout exception too.
For example:
`@func_set_timeout(3)
def capp(rtsp):
return cv2.VideoCapture(rtsp)

rtsp_list = [readable stream1, readable stream2, unreadable stream3, readable stream4, readable stream5...]
`
When recycling the parameters in the list, only stream1 and stream2 can correctly return the capture, while all the rest readable stream will be timeout just because they are visited later than the unreadable stream3 be.

I'm troubled with this problem, hope for your reply soon.
Thank you.

@kata198
Copy link
Owner

kata198 commented Apr 23, 2023

Can you provide a more complete example with what you are doing?
If you are using it like

results = []
for stream in rtsp_list:
try:
results.append( capp(stream) )
except FunctionTimedOut:
print ( "Do something here" )

then it should be fine, "results" will only contain the completed stream.
If you are doing this and still having issues, it's possible that the video capture tool you are using has some cleanup or similar which isn't getting executed upon early termination. I would try creating a new instance of the stream reading object for every iteration, or recreating it upon a function timeout.

If you can provide a clearer example that I could test, I might be able to provide further input.

@chanyyyy
Copy link
Author

chanyyyy commented Apr 23, 2023 via email

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