Fix global variable placement
This commit is contained in:
parent
cfe01eb63e
commit
8fe81e3ab3
@ -518,7 +518,6 @@ def parse_version_rss(raw_rss, release):
|
||||
|
||||
This sets these global variables:
|
||||
latest_version
|
||||
latest_version_next_check
|
||||
release_supported
|
||||
|
||||
It is expected that the caller already holds the latest_version_lock lock.
|
||||
@ -528,7 +527,6 @@ def parse_version_rss(raw_rss, release):
|
||||
release: The PostgreSQL release we care about (ex: 9.2, 14)
|
||||
"""
|
||||
global latest_version
|
||||
global latest_version_next_check
|
||||
global release_supported
|
||||
|
||||
# Regular expressions for parsing the RSS document
|
||||
@ -583,6 +581,8 @@ def get_latest_version():
|
||||
Get the latest supported version of the major PostgreSQL release running on the server being monitored.
|
||||
"""
|
||||
|
||||
global latest_version_next_check
|
||||
|
||||
# If we don't know the latest version or it's past the recheck time, get the
|
||||
# version from the PostgreSQL RSS feed. Only one thread needs to do this, so
|
||||
# they all try to grab the lock, and then make sure nobody else beat them to it.
|
||||
@ -705,7 +705,10 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
|
||||
self._reply(
|
||||
200,
|
||||
json.dumps(
|
||||
{"latest": latest_version, "supported": 1 if release_supported else 0}
|
||||
{
|
||||
"latest": latest_version,
|
||||
"supported": 1 if release_supported else 0,
|
||||
}
|
||||
),
|
||||
)
|
||||
except LatestVersionCheckError as e:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user