#2810 cli: fix multicall usage in list_hosts
Merged 3 years ago by tkopecek. Opened 3 years 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

3 years ago

Commit 7d49052 fixes this pull-request

Pull-Request has been merged by tkopecek

3 years ago
Metadata