Skip to content

Commit

Permalink
Monitor URL defaults to None
Browse files Browse the repository at this point in the history
  • Loading branch information
magnified103 committed Oct 14, 2024
1 parent cee9b05 commit efc2c62
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dmoj/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@
BRIDGED_JUDGE_PROXIES = None
BRIDGED_DJANGO_ADDRESS = [('localhost', 9998)]
BRIDGED_DJANGO_CONNECT = None
BRIDGED_MONITOR_UPDATE_URL = 'http://localhost:9990/update/problems'
BRIDGED_MONITOR_UPDATE_URL = None

# Event Server configuration
EVENT_DAEMON_USE = False
Expand Down
13 changes: 7 additions & 6 deletions judge/views/problem_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,13 @@ def import_problem(self, user_id, problem, new_code):
revisions.set_comment(_('Imported from %s%s') % (
settings.VNOJ_PROBLEM_IMPORT_HOST, reverse('problem_detail', args=(old_code,))))
url = settings.BRIDGED_MONITOR_UPDATE_URL
logger.info('Pinging for problem update: %s', url)
try:
with closing(urlopen(url, data=b'')) as f:
f.read()
except Exception:
logger.exception('Failed to ping for problem update: %s', url)
if url:
logger.info('Pinging for problem update: %s', url)
try:
with closing(urlopen(url, data=b'')) as f:
f.read()
except Exception:
logger.exception('Failed to ping for problem update: %s', url)


class ProblemImportView(TitleMixin, FormView):
Expand Down

0 comments on commit efc2c62

Please sign in to comment.