#4128 min_event calculation can fail if koji instance is new
Closed: Fixed by tkopecek. Opened by mikem.

The min_event calculation for repo requests hinges mainly on the last event before a recent timestamp based on the RepoLag setting. In a brand new instance, there might not be an event older than the lag setting and getLastEvent can error. E.g. this trace:

  File "/usr/lib/python3.12/site-packages/kojihub/kojixmlrpc.py", line 273, in _wrap_handler
    response = handler(environ)
               ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/kojihub/kojixmlrpc.py", line 300, in handle_rpc
    return self._dispatch(method, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/kojihub/kojixmlrpc.py", line 337, in _dispatch
    ret = koji.util.call_with_argcheck(func, params, opts)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/koji/util.py", line 507, in call_with_argcheck
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/kojihub/repos.py", line 727, in request_repo
    min_event = default_min_event(taginfo)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/kojihub/repos.py", line 817, in default_min_event
    base = context.handlers.get('getLastEvent')(before=base_ts)['id']
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/kojihub/kojihub.py", line 11142, in getLastEvent
    return query.executeOne(strict=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/kojihub/db.py", line 888, in executeOne
    raise koji.GenericError('query returned no rows')
koji.GenericError: query returned no rows

Metadata Update from @mikem:
- Custom field Size adjusted to None
- Issue set to the milestone: 1.35

Metadata Update from @tkopecek:
- Issue tagged with: testing-ready

Metadata Update from @mfilip:
- Issue tagged with: testing-done

Commit f70ba74d fixes this issue

This issue has been migrated to Fedora Forge:
https://forge.fedoraproject.org/koji/koji/issues/4128

Please continue any further discussion there.

Metadata
Related Pull Requests