handle invalid release time

This commit is contained in:
Jack Robison 2021-09-15 13:32:11 -04:00
parent ece2d1e78a
commit be6b72edcd
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 7 additions and 2 deletions

View file

@ -979,8 +979,12 @@ class LBRYElectrumX(SessionBase):
async def claimtrie_search(self, **kwargs):
start = time.perf_counter()
if isinstance(kwargs, dict):
kwargs['release_time'] = format_release_time(kwargs.get('release_time'))
if 'release_time' in kwargs:
release_time = kwargs.pop('release_time')
try:
kwargs['release_time'] = format_release_time(release_time)
except ValueError:
pass
try:
self.session_mgr.pending_query_metric.inc()
if 'channel' in kwargs:

View file

@ -1767,6 +1767,7 @@ class StreamCommands(ClaimTestCase):
self.assertEqual(3, len(await self.claim_search(release_time='>0', order_by=['release_time'])))
self.assertEqual(3, len(await self.claim_search(release_time='>=0', order_by=['release_time'])))
self.assertEqual(4, len(await self.claim_search(order_by=['release_time'])))
self.assertEqual(4, len(await self.claim_search(release_time='<derp', order_by=['release_time'])))
self.assertEqual(3, len(await self.claim_search(claim_type='stream', order_by=['release_time'])))
self.assertEqual(1, len(await self.claim_search(claim_type='channel', order_by=['release_time'])))
self.assertEqual(1, len(await self.claim_search(release_time='>=123456', order_by=['release_time'])))