Skip to content

Conversation

@konard
Copy link
Owner

@konard konard commented Oct 17, 2025

Summary

Implements automated removal of the most inactive friends to make room for incoming friend requests when the 10,000 friend limit is reached.

Changes

  • New trigger: remove-inactive-friends.js - Automatically removes the least active friends when:

    • There are incoming friend requests waiting to be accepted
    • Current friend count is at or near the 10,000 maximum limit
  • Sorting algorithm: Friends are sorted by activity level using:

    • last_seen.time timestamp (earlier = more inactive)
    • Friends without last_seen data are considered most inactive
    • Online friends are prioritized over offline friends
  • Protection mechanisms:

    • Priority friends (defined in utils.js) are never removed
    • Deactivated friends are never removed (they are handled by a separate trigger)
  • Integration: The trigger runs every 18 minutes (2 minutes before accept-friend-requests trigger), ensuring space is available for incoming requests

  • Comprehensive tests: Added unit tests covering all edge cases including priority friends protection, deactivated friends protection, and proper sorting by activity

  • Experiment script: Added test script for manual validation

Test Plan

  • Unit tests pass for all scenarios
  • Priority friends are protected from removal
  • Deactivated friends are not removed
  • Most inactive friends are selected for removal
  • Trigger only activates when necessary (incoming requests + at limit)
  • Integration with existing friend management triggers works correctly

Fixes #21

🤖 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
Implements automated removal of the most inactive friends to make room for incoming friend requests when the 10,000 friend limit is reached.

The trigger:
- Checks for incoming friend requests
- Only activates when friend count reaches maximum (10,000)
- Removes the least active friends based on last_seen timestamp
- Protects priority friends from removal
- Protects deactivated friends from removal
- Runs every 18 minutes, before accepting new requests

Fixes #21

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

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Remove the most inactive friends just enough to receive new friend requests Remove the most inactive friends just enough to receive new friend requests Oct 17, 2025
@konard konard marked this pull request as ready for review October 17, 2025 17:03
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.

Remove the most inactive friends just enough to receive new friend requests

1 participant