Skip to content

Commit c6aa21c

Browse files
committed
added function to reload sos cache
1 parent d963194 commit c6aa21c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

geosk/osk/api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ def deletesensor(request, template='osk/osk_deletesensor.html'):
7979
tr = etree.fromstring(sos_response.content)
8080
if tr.tag == nspath_eval("ows110:ExceptionReport", namespaces):
8181
return json_response(exception=sos_response.text.encode('utf8'), status=500)
82+
# force sos cache reload
83+
force_soscache_reload()
8284

8385
# todo: remove Sensor object
8486
return HttpResponseRedirect(reverse("osk_browse"))
@@ -220,3 +222,8 @@ def ediproxy_importmd(request):
220222
return json_response(body={'success':True,'redirect': reverse('osk_browse')})
221223
else:
222224
return json_response(exception=sos_response.text.encode('utf8'), status=500)
225+
226+
227+
def force_soscache_reload():
228+
if hasattr(settings, 'SOS_ADMIN_CACHE_RELOAD_URL') and hasattr(settings, 'SOS_ADMIN_USER') and hasattr(settings, 'SOS_ADMIN_PASSWORD'):
229+
requests.post(settings.SOS_ADMIN_CACHE_RELOAD_URL, auth=(settings.SOS_ADMIN_USER, settings.SOS_ADMIN_PASSWORD))

0 commit comments

Comments
 (0)