#1653 Allow ClientSession objects to get cleaned up by the garbage collector
Merged by mikem. Opened by mprahl.
Unknown source master

Download 1653.patch

rebased onto 49446e1bf0f744a07d6d2d334d33a1c8a6a52cf1

rebased onto 630f8323debf11d0f504d39371e725c39110b00c

This looks mostly like the right thing, but I have a slight pause about the possibility of a MultiCallSession class outliving the session it is based on. I'm not sure if that's completely sane, but it's not completely unreasonable either.

Seems like while we need to avoid the circular reference, we still ought to have a real reference in MultiCallSession. Maybe something like this?

https://github.com/mikem23/koji-playground/commits/pagure/pr/1653

Here's a simple example

import koji
def get_multi():
    session = koji.ClientSession('https://koji.fedoraproject.org/kojihub')
    return session.multicall()
with get_multi() as m:
    builds = [m.getBuild(i) for i in range(5000,100000, 10000)]
builds = [b.result for b in builds]

Again, maybe not completely sane for the MultiCallSession to continue after the base session is unreferenced, but I don't necessarily see why it shouldn't work either.

rebased onto a552a248dbed7238ee5ae071105e1992844b947f

Thanks @mikem. How does this look?

:thumbsup:

Commit a5af69c9 fixes this pull-request

Pull-Request has been merged by mikem

Metadata