Skip to content

Conversation

@sligara7
Copy link

@sligara7 sligara7 commented Apr 24, 2025

  1. Backend Selection
  • Added support for selecting the backend (Redis or SQLite) using the PLAN_QUEUE_BACKEND environment variable.
  • Default backend is Redis.
  • If PLAN_QUEUE_BACKEND=sqlite, the SQLite backend is used.
  1. SQLite Database Initialization
  • Added _initialize_sqlite_database to create required tables (kv_store, plan_queue, plan_history) if they do not exist.
  • Tables include:
    • kv_store: For key-value pairs.
    • plan_queue: For storing the plan queue with a UNIQUE constraint on item_uid.
    • plan_history: For storing the plan history with a UNIQUE constraint on item_uid.
  1. Backend-Specific Helper Methods
  • Added backend-agnostic methods that encapsulate logic for both Redis and SQLite. These methods dynamically determine the backend and execute the appropriate logic.
  1. SQLite Connection Management
  • Added logic to manage SQLite connections:
    • Open connection during start.
    • Close connection during stop.
  1. UID Management
  • Ensured that item_uid uniqueness is enforced in SQLite:
    • Added item_uid as a UNIQUE column in plan_queue and plan_history tables.
    • Checked for duplicate item_uid values before inserting items into SQLite.
  1. Testing and Compatibility
  • Updated methods like _get_queue, _add_item_to_queue, _remove_item, etc., to work seamlessly with both Redis and SQLite backends.
  • Ensured consistent behavior across both backends by using the backend-agnostic helper methods.

@sligara7 sligara7 marked this pull request as draft April 24, 2025 16:40
@sligara7 sligara7 marked this pull request as ready for review April 24, 2025 16:41
@sligara7 sligara7 marked this pull request as draft April 24, 2025 16:41
@sligara7 sligara7 marked this pull request as ready for review April 24, 2025 16:41
@sligara7 sligara7 marked this pull request as draft April 24, 2025 16:42
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.

1 participant