Skip to content

Handle error when friends limit (10000) is reached#26

Open
konard wants to merge 3 commits intomainfrom
issue-10-522d6548
Open

Handle error when friends limit (10000) is reached#26
konard wants to merge 3 commits intomainfrom
issue-10-522d6548

Conversation

@konard
Copy link
Copy Markdown
Owner

@konard konard commented Oct 17, 2025

Summary

This PR implements automatic handling of the VK friends limit (10,000 friends) to prevent errors and maintain smooth operation of the friend request automation.

Problem Addressed

When the friends limit is reached, the VK API returns error code 1 with "Unknown error occurred" when trying to accept friend requests. The automation would continue trying to accept requests without success.

Solution

State Management:

  • Tracks current friends count in friends-state.json file
  • Updates count before and after each operation cycle

Limit Detection & Handling:

  • Checks friends count before accepting requests
  • Uses 50-friend safety margin (accepts only when count < 9,950)
  • When limit reached, automatically:
    1. Cancels all outgoing friend requests
    2. Deletes inactive friends (not seen in 3 days) in batches
    3. Skips accepting new requests until below limit

Implementation Details:

  • Application/getFriendsCount.js - VK API method to get current friends count
  • get-friends-count.sh - Shell wrapper for friends count retrieval
  • manage-friends-limit.sh - Main logic for limit detection and cleanup
  • Updated Application/acceptAllFriendRequests.js to return structured response
  • Integrated into do-all.sh main automation loop

Testing:

  • Created experiments/test-friends-limit-logic.sh to validate implementation
  • All tests passing ✓

Files Changed

  • .gitignore - Added friends-state.json
  • Application/acceptAllFriendRequests.js - Better error handling and return structure
  • Application/getFriendsCount.js - New: Get current friends count
  • do-all.sh - Integrated friends limit management
  • get-friends-count.sh - New: Friends count retrieval script
  • manage-friends-limit.sh - New: Main friends limit management logic
  • experiments/test-friends-limit-logic.sh - New: Test script

Fixes #10

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: undefined
@konard konard self-assigned this Oct 17, 2025
- Add friends count tracking with state file (friends-state.json)
- Create manage-friends-limit.sh to check and manage friends limit
- Automatically cancel outgoing requests and delete inactive friends when limit reached
- Skip accepting friend requests when at or near limit (10000 - 50 safety margin)
- Update acceptAllFriendRequests.js to return structured response
- Integrate friends limit management into do-all.sh main loop
- Add test script to validate solution logic

Fixes #10

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Handle error when friends limit (10000) is reached Handle error when friends limit (10000) is reached Oct 17, 2025
@konard konard marked this pull request as ready for review October 17, 2025 16:12
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.

Handle error when friends limit (10000) is reached

1 participant