Xqt added a comment.

  Hi @ericpien: I think `preload_sites` script is a good measurement. After 
collecting the `siteinfo` (and after Pywikibot 8.1 `userinfo`) the second call 
must much more faster. Thank you for your patch but I would suggest to use the 
already implemented CachedRequest 
<https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.data.html#data.api.CachedRequest>
 to cache the userinfo which is already used for `siteinfo`. The advantage is 
that parallel running task will also benefit from it. At userinfo 
<https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.site.html#pywikibot.site._apisite.APISite.userinfo>
 method the cached request can be implemented like
  
    if not hasattr(self, '_userinfo'):
        uirequest = self._request(
            expiry=1,
            parameters=dict(
                action='query',
                meta='userinfo',
                uiprop='blockinfo|hasmsg|groups|rights|ratelimits',
                formatversion=2,
            )
        )
        uidata = uirequest.submit()
  
  The 2nd run needs only ~30 seconds with this patch compared to 8 minutes 
without it. Maybe we could add some runtime test like this to our test matrix.

TASK DETAIL
  https://phabricator.wikimedia.org/T348925

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Xqt
Cc: ericpien, Aklapper, pywikibot-bugs-list, Xqt, mevo, Susie413113, 
PotsdamLamb, Jyoo1011, JohnsonLee01, SHEKH, Dijkstra, Khutuck, Zkhalido, 
Viztor, Wenyi, Tbscho, MayS, Vali.matei, Mdupont, JJMC89, Dvorapa, Altostratus, 
Avicennasis, Wong128hk, mys_721tx, Dinoguy1000, jayvdb, Masti, Alchimista, Jay8g
_______________________________________________
pywikibot-bugs mailing list -- pywikibot-bugs@lists.wikimedia.org
To unsubscribe send an email to pywikibot-bugs-le...@lists.wikimedia.org

Reply via email to