This commit is contained in:
James Tomasino 2022-04-11 00:00:03 +00:00
parent b47d9b2576
commit 0b38675c21
2 changed files with 16 additions and 17 deletions

View File

@ -54,7 +54,7 @@ class Config:
nntp_server="localhost",
# TODO: find more appropriate one
nntp_group="cosmic.worldbuilding",
max_submission=1,
max_submission=5,
submission_store_dir="/var/tmp/q2n",
)
@ -268,7 +268,12 @@ class SubmissionThrottler:
def main():
logging.basicConfig()
logging.root.setLevel(logging.INFO)
config = Config.create()
_LOGGER.info(f"Running with config: {config}")
utils = Utils(config=config)
iterate_logs = ListingFileLogIterator(
@ -277,21 +282,8 @@ def main():
utils=utils,
)
throttler = SubmissionThrottler(config.max_submission)
# --- REMOVE
logs = iterate_logs()
for log in logs:
utils.read_log_content(log)
print(f'read log: {log}')
# --- REMOVE
submission_store = SubmittedLogsStore(store_dir=config.submission_store_dir)
should_submit = SubmitConditionImpl(submission_store=submission_store)
logs_to_submit = [log for log in iterate_logs() if should_submit(log)]
# TODO: remove - randomly choose one log
logs_to_submit = logs_to_submit[random.randint(0, len(logs_to_submit)-2):][0:]
logs_to_submit = throttler(logs_to_submit)
submit_log = NntpLogSubmitter(
submission_store=submission_store,
read_log_entry=utils.read_log_content,
@ -299,6 +291,12 @@ def main():
nntp_server=config.nntp_server,
dry_run=True, # TODO remove
)
logs_to_submit = [log for log in iterate_logs() if should_submit(log)]
### # FOR TEST: remove - randomly choose one log
### logs_to_submit = logs_to_submit[random.randint(0, len(logs_to_submit)-2):][0:]
logs_to_submit = throttler(logs_to_submit)
_LOGGER.info(f"Submitting {len(logs_to_submit)} logs...")
for log in logs_to_submit: submit_log(log)

View File

@ -1,4 +1,4 @@
{"name": "cosmic.voyage", "url": "https://cosmic.voyage", "signup_url": "https://cosmic.voyage/join.html", "user_count": 221, "want_users": true, "admin_email": "james@tomasino.org", "description": "Cosmic Voyage is a public-access unix system and tilde community based around a collaborative science-fiction universe. Users write stories as the people aboard ships, colonies, and outposts, using the only remaining free, interconnected network that unites the dispersed peoples of the stars.", "users": [{"username":"tomasino"},
{"name": "cosmic.voyage", "url": "https://cosmic.voyage", "signup_url": "https://cosmic.voyage/join.html", "user_count": 222, "want_users": true, "admin_email": "james@tomasino.org", "description": "Cosmic Voyage is a public-access unix system and tilde community based around a collaborative science-fiction universe. Users write stories as the people aboard ships, colonies, and outposts, using the only remaining free, interconnected network that unites the dispersed peoples of the stars.", "users": [{"username":"tomasino"},
{"username":"demosthenes"},
{"username":"chiaroscuro"},
{"username":"tildebeast"},
@ -198,7 +198,6 @@
{"username":"avrak"},
{"username":"puddlegorf"},
{"username":"aok"},
{"username":"delo"},
{"username":"ayko"},
{"username":"archer51"},
{"username":"oliver"},
@ -218,4 +217,6 @@
{"username":"tilda"},
{"username":"lkh"},
{"username":"blair"},
{"username":"grizzly"}]}
{"username":"grizzly"},
{"username":"lowden"},
{"username":"hfsean"}]}