Skip to content

fix(config): add mtime-based caching, fix scraper_timeout default - #233

Open
tatenda-source wants to merge 2 commits into
FujiwaraChoki:mainfrom
tatenda-source:fix/config-caching-timeout
Open

fix(config): add mtime-based caching, fix scraper_timeout default#233
tatenda-source wants to merge 2 commits into
FujiwaraChoki:mainfrom
tatenda-source:fix/config-caching-timeout

Conversation

@tatenda-source

Copy link
Copy Markdown

Summary

  • Add mtime-based config caching so config.json is only re-read when modified
  • Fix get_scraper_timeout() treating valid 0 as falsy
  • Add config.json existence check with helpful error message

Closes #224

Test plan

  • Verify config values are read correctly
  • Verify config changes are picked up after file modification
  • Test with missing config.json for clear error message

🤖 Generated with Claude Code

Closes FujiwaraChoki#224

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8262002234

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/config.py Outdated
"""
with open(os.path.join(ROOT_DIR, "config.json"), "r") as file:
return json.load(file)["scraper_timeout"] or 300
return _load_config().get("scraper_timeout", 300) or 300

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve explicit zero scraper timeout

get_scraper_timeout() still coerces a configured 0 to 300 because the new expression keeps or 300. In environments where config.json intentionally sets scraper_timeout to 0, the runtime will continue using 300 seconds instead of the configured value, so the stated fix for falsy-zero behavior is not actually applied.

Useful? React with 👍 / 👎.

Use `is not None` check instead of `or 300` so that a configured
value of 0 is respected rather than coerced to 300.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc34dd7f84

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/config.py
with open(os.path.join(ROOT_DIR, "config.json"), "r") as file:
return json.load(file)["scraper_timeout"] or 300
timeout = _load_config().get("scraper_timeout")
return timeout if timeout is not None else 300

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve default for blank scraper timeout values

This change now returns any non-None scraper_timeout value directly, so a config value like "" (or other non-numeric placeholders users may leave while editing) no longer falls back to 300 and instead propagates to Outreach.run_scraper_with_args_for_30_seconds, where float(timeout) raises a ValueError. Before this commit, falsy placeholders were coerced to the safe default via or 300, so this introduces a runtime regression for previously tolerated configs.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(config): repeated file I/O and scraper_timeout falsy-zero bug

1 participant