Skip to content

Gift indexer 2.0 (BotAPI) - #236

Merged
danoctua merged 36 commits into
mainfrom
dev
Sep 25, 2026
Merged

danoctua merged 36 commits into
mainfrom
dev

Conversation

@danoctua

@danoctua danoctua commented Apr 4, 2026 •

Copy link
Copy Markdown
Collaborator

[DON'T MERGE UNTIL FEATURES ARE TESTED ON DEV]

Description

[Please include a summary of the changes made in this pull request. Mention the issue(s) this pull request fixes (if any), and provide a brief context about the problem you're solving.]

Fixes: #[issue number] (if applicable)

Checklist

Before submitting your pull request, please ensure the following:

  • I have read the contributing guidelines.
  • I ran all tests and they passed successfully.
  • I added/updated documentation (if applicable).
  • I reviewed my own code and followed the project's code style.
  • I included relevant details in the PR description or commit messages.

Changes

[Provide a high-level overview of what changes you made. Mention any new features, bug fixes, or performance improvements. Also, note if there are breaking changes.]

  • Change 1: [High-level description of the change]
  • Change 2: [High-level description of the change]
  • ...

How Has This Been Tested?

[Describe how you tested your changes. Mention the environment (e.g., OS, browser, API version) and tools used to verify the functionality.]

Screenshots (if applicable)

[Provide screenshots or screencasts of your changes where visual updates occurred.]

Additional Notes

[(optional) Leave any extra information, concerns, or comments you would like the reviewers to know.]


Thank you for contributing! 🎉

@danoctua
danoctua force-pushed the dev branch 2 times, most recently from ea0c2f6 to 213db1d Compare June 3, 2026 19:47
@danoctua danoctua self-assigned this Jun 3, 2026
@danoctua danoctua added duplicate This issue or pull request already exists gifts labels Jun 3, 2026
- Update GiftCollection model: replace slug PK with integer id, add options (JSONB) and blockchain_address fields
- Update GiftUnique model: replace collection_slug FK with collection_id FK
- Update TelegramChatGiftCollection model: replace collection_slug FK with collection_id FK
- Create Alembic migration with schema changes, data migration from JSON mapping, and cleanup
- Refactor DTOs, services, actions, and API routes to use integer IDs
- Update chat eligibility logic (find_relevant_gift_items) to use collection_id
- Temporarily disable gift indexer tasks and comment out slug-dependent indexer methods
- Update get_metadata to remove slug filtering and reduce cache TTL to 5 minutes
- Migrate whitelisted_gift_collections.txt from slugs to integer IDs
- Update indexer actions and tasks to use IDs instead of slugs in get_all calls
- Ensure indexer remains disabled with early return in tasks.py
Updated the `GiftCollection` query to order results by `title` instead of `id` for consistent sorting.
danoctua and others added 15 commits September 24, 2026 23:23
Also updates UserAction.refresh_gifts to use sender.send_task and fixes its tests.
…API exceptions

This adds an asyncio.sleep(0.250) on close to allow aiohttp SSL transports to cleanly disconnect, preventing SIGKILL from file descriptor leaks. It also ensures 'user not found' exceptions are correctly raised rather than wiping a user's DB gifts.
…sers

- Moves batch syncing into IndexerUserGiftAction to share a single BotApiGiftIndexer instance, vastly reducing overhead and event loop thrashing.
- Adds UserService.mark_as_blocked() and excludes blocked users from global fetches.
- Automatically marks users as blocked when Telegram returns a 'user not found' exception during gift sync.
Avoids unnecessary DB UPDATE queries for gifts that already belong to the user being synced, significantly reducing write load during recurring batch refreshes.
@danoctua danoctua added enhancement New feature or request and removed duplicate This issue or pull request already exists labels Sep 25, 2026
@danoctua
danoctua marked this pull request as ready for review September 25, 2026 18:13
@danoctua danoctua changed the title Merge dev to main Gift indexer 2.0 (BotAPI) Sep 25, 2026
@danoctua
danoctua merged commit f89fbaf into main Sep 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request gifts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants