Salz0 / telegram_flea

A open-source flea market bot, to be used in any Community
MIT License
9 stars 21 forks source link

🧅 Implement Redis Storage for Data Persistence #21

Closed Salz0 closed 9 months ago

Salz0 commented 10 months ago

Issue: Implement Redis Storage for Data Persistence

Problem Description

Currently, the bot is using in-memory storage for FSM (Finite State Machine) which loses all its data when the bot is restarted. This may not be ideal for production where uptime and data integrity are important.

Objective

Implement a Redis storage solution to replace the existing MemoryStorage for better data persistence.

Suggested Changes

  1. Add Redis to your project's dependencies.
  2. Modify the storage = MemoryStorage() line to use Redis-based storage.
  3. Ensure that all existing FSM states and data points are moved to Redis.
  4. Test thoroughly to make sure all functionalities remain intact post-migration.

Code Snippet

Replace:

storage = MemoryStorage()

Acceptance Criteria

  1. Data should be persistent across bot restarts.
  2. All FSM states should function as expected but now backed by Redis.
  3. Measure and confirm that the bot's performance isn't negatively affected by this change.
  4. Testing
  5. Ensure all existing unit and integration tests pass after these changes. If possible, add tests to confirm that the Redis storage behaves as expected.

Please contribute by making a Pull Request that resolves this issue. Thank you! 🌟🔒

BloodyOcean commented 10 months ago

I'd like to take this issue

@Salz0