Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kzc3G-0000GS-Pb for pgadmin-hackers@arkaria.postgresql.org; Wed, 13 Jan 2021 09:02:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kzc3F-0007hU-BQ for pgadmin-hackers@arkaria.postgresql.org; Wed, 13 Jan 2021 09:02:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kzc3E-0007hN-IJ for pgadmin-hackers@lists.postgresql.org; Wed, 13 Jan 2021 09:02:49 +0000 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kzc39-0000bj-PI for pgadmin-hackers@lists.postgresql.org; Wed, 13 Jan 2021 09:02:47 +0000 Received: by mail-ej1-x633.google.com with SMTP id ga15so1986415ejb.4 for ; Wed, 13 Jan 2021 01:02:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pgadmin.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=D45m7gco4SygESucO75q/p2pBZtPsDmjoa0qHxZSHXI=; b=ZUhQh88ozKfW/pKvJkXJc0XjDelLts8sywn0HnE7MECuEE3r6x1HRrf14zzNO/A+7+ M/6kh+tbXiZViBP+LZB3pOKxEOvr4ilXEgrgWukg/7gAje6qa+cuulz6mOJdoW1aa+iZ 3A3Si5N4TLBnDgnA0y0swCe6piKslWIZ2wGhT4R1BoRwf2G4NX6SI/LXalGINNAquKOu 2igq1a7FjttMvpKNNEmnSAKsStx9kJVA7PoxhJnmnGD/v0RrdbI0M/X63g7SJw0zc4Vr uTsh7PAsh4PkTAkdoUqIjFAG2ZmOBuTGCGxgyQayNfsfZojs5aakUEV65z8+ab7DSr+7 CRgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=D45m7gco4SygESucO75q/p2pBZtPsDmjoa0qHxZSHXI=; b=inbmYTdlya2dw9kitDSHeJQVkWFtcYCWfCaL4feDGJr6567wO2tUgqpbZj32pK8we4 HuAi3T2ndS1WGcGnTU3HJVkmMx48jJ+KBRe5u//X/9MCJ2oxOgQqfsiJV72bvU0dQWcU AbwRPUOOV9WVHrxLRPt4krNGxCI5NNwaOTIeh+YdUQnvYncV5wHKcXvIm0b5rXkxrvpt P2MP4/OwcgKf1zgPsefMXnU3jMGYxzljc/sdUtXL/RGi1Qhu0Tn1e7Pnn8dU7ZnsQzpZ EHa6HRUfK/pnQOT9orQojGNcuFTfr0/iqpplGVeEK8zmEv9951/N8Co79LIe7bwf2kWC cTtw== X-Gm-Message-State: AOAM5328XeLN8WUQW8AT2AxN/jRYg5HfFcjlOlnWdc7e31IfNAGiQdeU nCNvH0H+TfAJvN6iy1zWjwoPov+7ACZbAgV6Wlhv+Q== X-Google-Smtp-Source: ABdhPJzgJt1iXffnf6p4lePYyjx0piZgc1pDlW9/lwXMpESoULrfUHZv7SO7+Ql8B4JYo+4/G4hJDWpFCA6464MXXUQ= X-Received: by 2002:a17:906:b24c:: with SMTP id ce12mr823636ejb.89.1610528560952; Wed, 13 Jan 2021 01:02:40 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Dave Page Date: Wed, 13 Jan 2021 09:02:29 +0000 Message-ID: Subject: Re: Somewhat excessive version checks To: Magnus Hagander Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="000000000000c6d25d05b8c466f7" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000c6d25d05b8c466f7 Content-Type: text/plain; charset="UTF-8" On Tue, Jan 12, 2021 at 7:50 PM Magnus Hagander wrote: > On Tue, Jan 12, 2021 at 9:57 AM Dave Page wrote: > > > > On Mon, Jan 11, 2021 at 10:06 PM Magnus Hagander > 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 --000000000000c6d25d05b8c466f7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Tue, Jan 12, 2021 at 7:50 PM Magnu= s Hagander <magnus@hagander.net> wrote:
On= Tue, Jan 12, 2021 at 9:57 AM Dave Page <dpage@pgadmin.org> wrote:
>
> On Mon, Jan 11, 2021 at 10:06 PM Magnus Hagander <magnus@hagander.net> wrote:<= br> >>
>> 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<= br> >> 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, n= o you're right. It's a long time since I wrote that code :-/
<= div>=C2=A0


>> 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 doe= s
>> call out to make that check synchronously on startup which means t= he
>> 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 go= ing
>> 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 eta= g be
>> say the version that the client has, it becomes very cheap to chec= k
>> 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=3D

Yes - the SQLite config database.=C2=A0 See pgadmin.model.

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

EDB= : http://www.ente= rprisedb.com

--000000000000c6d25d05b8c466f7--