Re: Somewhat excessive version checks

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: pgadmin-hackers <pgadmin-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Somewhat excessive version checks
Date: 2021-01-13 09:02:29
Message-ID: CA+OCxow+z9aW61irF41i-hWhBeWFSiimZNn+1TWFsdd6QNVfXA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

On Tue, Jan 12, 2021 at 7:50 PM Magnus Hagander <magnus(at)hagander(dot)net> wrote:

> On Tue, Jan 12, 2021 at 9:57 AM Dave Page <dpage(at)pgadmin(dot)org> wrote:
> >
> > On Mon, Jan 11, 2021 at 10:06 PM Magnus Hagander <magnus(at)hagander(dot)net>
> wrote:
> >>
> >> Hi!
> >>
> >> If I read the code correctly, pgadmin will (unless turned off) hit the
> >> website to check the version.json file for updates *every time it
> >> starts*.
> >
> >
> > Every time the server starts, which is a little different, but still...
>
> Hmm. So one of us is definitely reading things wrong then :) I see it
> in the index() method, which has an URL router for / -- isn't that
> called for every time somebody somebody starts their browser to it?
> I'm not saying for every reload, but with a server install with 10
> users, won't it do it once for each?
>
> Or when is that actually called?
>

Huh, no you're right. It's a long time since I wrote that code :-/

>
>
> >> Wouldn't it make sense to rate limit that to checking say once per 24
> >> hours maximum? Or even 48?
> >
> >
> > That certainly wouldn't be a bad idea.
> >
> >>
> >>
> >> It seems nobody needs the update *that* quickly, and AFAICT it does
> >> call out to make that check synchronously on startup which means the
> >> user is waiting.
> >>
> >> And if/when doing that, it would be useful to include an
> >> If-Modified-Since header on the request, so the server can just
> >> respond with a tiny 304 reply when there is no update, which is going
> >> to be the majority of the time. Or possibly even more efficiently,
> >> create a custom etag and use If-None-Matches. If you make that etag be
> >> say the version that the client has, it becomes very cheap to check
> >> and you don't need to track any extra data.
> >
> >
> > Patches welcome!
>
> Hah, I clearly can't even figure out when the method is called :)
>
> And presumably you'd also want some place to store the state between
> calls, so you can keep showing the warnings about upgrades? Do you
> have state storage for such things arleady=
>

Yes - the SQLite config database. See pgadmin.model.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EDB: http://www.enterprisedb.com

In response to

Browse pgadmin-hackers by date

  From Date Subject
Next Message Khushboo Vashi 2021-01-13 09:05:38 Re: [pgAdmin4][Patch] - RM 5457 - Kerberos Authentication - Phase 1
Previous Message Akshay Joshi 2021-01-13 06:54:05 Re: [pgAdmin][RM-6075]: Non-admin user is unable to view shared server created using 'Service'.