#2810 cli: fix multicall usage in list_hosts
Merged a year ago by tkopecek. Opened a year ago by tkopecek.
tkopecek/koji issue2497a  into  master

file modified
+13 -9
@@ -2885,17 +2885,21 @@ 

          else:

              return ''

  

+ 

+     try:

+         first = session.getLastHostUpdate(hosts[0]['id'], ts=True)

+         opts = {'ts': True}

+     except koji.ParameterError:

+         # Hubs prior to v1.25.0 do not have a "ts" parameter for getLastHostUpdate

+         first = session.getLastHostUpdate(hosts[0]['id'])

+         opts = {}

+ 

      # pull in the last update using multicall to speed it up a bit

-     session.multicall = True

-     for host in hosts:

-         try:

-             session.getLastHostUpdate(host['id'], ts=True)

-         except koji.ParameterError:

-             # Hubs prior to v1.25.0 do not have a "ts" parameter for getLastHostUpdate

-             session.getLastHostUpdate(host['id'])

-     updateList = session.multiCall()

+     with session.multicall() as m:

+         result = [m.getLastHostUpdate(host['id'], **opts) for host in hosts[1:]]

+     updateList = [first] + [x.result for x in result]

  

-     for host, [update] in zip(hosts, updateList):

+     for host, update in zip(hosts, updateList):

          if update is None:

              host['update'] = '-'

          else:

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

a year ago

Commit 7d49052 fixes this pull-request

Pull-Request has been merged by tkopecek

a year ago
Metadata