Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keep_alive #1684

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions geonode/geoserver/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
http_client,
get_legend_url,
is_monochromatic_image,
keep_alive,
set_resource_default_links)

from .security import set_geowebcache_invalidate_cache
Expand Down Expand Up @@ -1263,11 +1264,13 @@ def save_style(gs_style, layer):
sld_name = gs_style.name
sld_body = gs_style.sld_body
if not gs_style.workspace:
keep_alive()
logger.debug(f"save_style: creating style in geoserver {layer.workspace}:{style_name}")
gs_style = gs_catalog.create_style(
style_name, sld_body,
raw=True, overwrite=True,
workspace=layer.workspace)
keep_alive()

style = None
try:
Expand Down
7 changes: 7 additions & 0 deletions geonode/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
from requests.packages.urllib3.util.retry import Retry

from django.conf import settings
from django.db import connection
from django.core.cache import cache
from django.db.models import signals
from django.utils.http import is_safe_url
Expand Down Expand Up @@ -2300,3 +2301,9 @@ def get_xpath_value(
nsmap = element.nsmap
values = element.xpath(f"{xpath_expression}//text()", namespaces=nsmap)
return "".join(values).strip() or None


def keep_alive():
with connection.cursor() as cursor:
cursor.execute("select 1 from base_resourcebase limit 1")
row = cursor.fetchone()
Loading