This repository has been archived by the owner on Feb 23, 2022. It is now read-only.
forked from hedyorg/hedy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
168 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This file is used to configure gunicorn, | ||
# used on Heroku. | ||
|
||
def worker_exit(server, worker): | ||
# When the worker is being exited (perhaps because of a timeout), | ||
# give the query_log handler a chance to flush to disk. | ||
from website import querylog | ||
querylog.emergency_shutdown() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import ab_proxying | ||
from website import ab_proxying | ||
import unittest | ||
|
||
class TestAbTesting(unittest.TestCase): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from website import querylog | ||
import unittest | ||
|
||
class TestQueryLog(unittest.TestCase): | ||
def setUp(self): | ||
self.records = [] | ||
querylog.LOG_QUEUE.set_transmitter(self._fake_transmitter) | ||
|
||
def _fake_transmitter(self, ts, records): | ||
self.records.extend(records) | ||
|
||
def test_regular_xmit(self): | ||
with querylog.LogRecord(banaan='geel') as record: | ||
record.set(bloem='rood') | ||
|
||
querylog.LOG_QUEUE.transmit_now() | ||
|
||
self.assertEqual(len(self.records), 1) | ||
self.assertEqual(self.records[0]['banaan'], 'geel') | ||
self.assertEqual(self.records[0]['bloem'], 'rood') | ||
|
||
def test_emergency_recovery(self): | ||
querylog.begin_global_log_record(banaan='geel') | ||
querylog.log_value(bloem='rood') | ||
|
||
querylog.emergency_shutdown() | ||
|
||
recovered_queue = querylog.LogQueue(batch_window_s=300) | ||
recovered_queue.try_load_emergency_saves() | ||
recovered_queue.set_transmitter(self._fake_transmitter) | ||
|
||
self.assertEqual(self.records, []) | ||
|
||
recovered_queue.transmit_now() | ||
|
||
self.assertEqual(self.records[0]['banaan'], 'geel') | ||
self.assertEqual(self.records[0]['bloem'], 'rood') | ||
self.assertEqual(self.records[0]['terminated'], True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
import os | ||
import re | ||
from ruamel import yaml | ||
import querylog | ||
from website import querylog | ||
|
||
|
||
class Timer: | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.