这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@u5surf
Copy link
Owner

@u5surf u5surf commented Sep 18, 2025

Summary

  • Remove unused and duplicate functions from src/stats.rs to clean up the codebase
  • Preserve all essential nginx CABI integration and shared memory functionality
  • Maintain complete VTS statistics collection capabilities

Functions Removed

🗑️ init_shared_memory() - Unused Method

  • Location: VtsStatsManager::init_shared_memory()
  • Reason: Never called from anywhere in the codebase
  • Impact: None - functionality was not being used

🗑️ vts_init_shm_zone() - Duplicate Function

  • Location: src/stats.rs:263
  • Reason: Duplicate implementation of function already active in src/lib.rs:1193
  • Impact: None - lib.rs version continues to handle shared memory zone initialization

Functions Preserved

ngx_http_set_vts_zone() - KEPT

  • Location: src/lib.rs:799
  • Reason: Active nginx directive handler for vts_zone main 10m; configuration
  • Status: Essential for nginx CABI integration

vts_init_shm_zone() - KEPT

  • Location: src/lib.rs:1193
  • Reason: Actively used shared memory zone initialization callback
  • Status: Critical for nginx shared memory management

Verification

  • Build Success: cargo build --release passes
  • Test Suite: All 34 tests pass (1 intentionally ignored)
  • Code Quality: No clippy warnings
  • Functionality: Core VTS features completely preserved
  • nginx Integration: All CABI functions remain operational

Impact

This cleanup removes 31 lines of unused code while:

  • Maintaining 100% of VTS functionality
  • Preserving nginx configuration compatibility
  • Keeping all shared memory and statistics capabilities
  • Ensuring stable CABI integration

The codebase is now leaner without any loss of functionality.

🤖 Generated with Claude Code

u5surf and others added 4 commits September 18, 2025 18:28
- Remove unused init_shared_memory() method from VtsStatsManager
- Remove duplicate vts_init_shm_zone() function (active version remains in lib.rs)
- Preserve essential nginx CABI integration functions
- Maintain all core VTS functionality and shared memory handling

The removed functions were:
- init_shared_memory: Never called from anywhere in the codebase
- vts_init_shm_zone: Duplicate implementation, lib.rs version is actively used

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Add --test-threads=1 to CI test execution to prevent race conditions
- Re-enable test_vts_stats_persistence test after fixing isolation issues
- Ensures consistent test behavior across different environments

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Replace global state clearing with complete VtsStatsManager reset per test
- Add unique test identifiers to prevent cross-test interference
- Remove --test-threads=1 workaround as race conditions are now properly fixed
- Ensure deterministic test behavior without relying on execution order

This addresses the root cause of CI flaky tests by ensuring each test
has completely isolated state rather than just masking the symptoms.

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Apply standard Rust formatting to resolve CI checks
- Improve code readability with consistent formatting

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

Co-Authored-By: Claude <noreply@anthropic.com>
@u5surf u5surf merged commit 82ae7af into main Sep 18, 2025
4 checks passed
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.

2 participants