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

findByArg should return an iterable, not NoneType #27

Open
simon-ess opened this issue Aug 30, 2023 · 1 comment
Open

findByArg should return an iterable, not NoneType #27

simon-ess opened this issue Aug 30, 2023 · 1 comment

Comments

@simon-ess
Copy link

In https://github.com/ChannelFinder/pyCFClient/blob/9689d5bf/channelfinder/ChannelFinderClient.py#L334 we have that findByArgs returns None if the client gets a 404. However, in cfstore.py from recsync, we have

        for ch in client.findByArgs(prepareFindArgs(conf, [('~name', eachSearchString)])):
            existingChannels[ch["name"]] = ch

which results in repeated errors such as

2023-08-24T11:47:19+0000 [-] ERROR:recceiver.cfstore CF_COMMIT FAILURE: [Failure instance: Traceback: <class 'TypeError'>: 'NoneType' object is not iterable
	/usr/local/lib/python3.10/threading.py:1016:_bootstrap_inner
	/usr/local/lib/python3.10/threading.py:953:run
	/home/recceiver/venv/lib/python3.10/site-packages/twisted/_threads/_threadworker.py:47:work
	/home/recceiver/venv/lib/python3.10/site-packages/twisted/_threads/_team.py:182:doWork
	--- <exception caught here> ---
	/home/recceiver/venv/lib/python3.10/site-packages/twisted/python/threadpool.py:244:inContext
	/home/recceiver/venv/lib/python3.10/site-packages/twisted/python/threadpool.py:260:<lambda>
	/home/recceiver/venv/lib/python3.10/site-packages/twisted/python/context.py:117:callWithContext
	/home/recceiver/venv/lib/python3.10/site-packages/twisted/python/context.py:82:callWithContext
	/home/recceiver/venv/lib/python3.10/site-packages/recceiver/cfstore.py:275:_commitWithThread
	/home/recceiver/venv/lib/python3.10/site-packages/recceiver/cfstore.py:558:poll
	/home/recceiver/venv/lib/python3.10/site-packages/recceiver/cfstore.py:464:__updateCF__
	]

in the log. It would be better to return an empty list or some other empty iterable, or to even raise an exception to avoid this junk log data.

@simon-ess
Copy link
Author

Note that this could possible also be fixed on the recsync side; however, it seems generally better to return consistent data types where possible.

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

1 participant