Conversation
[462] 반복적 정책 활성화/비활성화 api 추가
[533] redis backup AOF 적용
dev to main
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (14)
📝 WalkthroughWalkthroughThis PR adds Redis AOF backup configuration management for the cache Redis instance with a startup validation service, and introduces an endpoint and service methods to toggle repeat-block policy activation status. DTOs are updated with field renames for consistency (enabled → isActive). Changes
Sequence Diagram(s)sequenceDiagram
participant App as Application<br/>(Startup)
participant Config as CacheRedisConfig
participant Service as CacheRedisAofBackupService
participant Redis as Redis Instance
participant Log as Logger
App->>Config: Boot ApplicationRunner
Config->>Service: Invoke ensureAofReady()
alt AOF Enabled
Service->>Service: Validate requested settings
opt ConfigureOnStartup
Service->>Redis: CONFIG SET (appendonly, appendfsync, etc)
Redis-->>Service: ACK
opt RewriteConfigOnStartup
Service->>Redis: CONFIG REWRITE
Redis-->>Service: ACK
end
end
Service->>Redis: CONFIG GET (verify settings)
Redis-->>Service: Current AOF state
Service->>Service: Compare & validate
opt FailFast Validation Failure
Service->>Log: Throw IllegalStateException
end
opt TriggerBackgroundRewrite
Service->>Redis: BGREWRITEAOF
Redis-->>Service: ACK
end
Service->>Log: Log readiness status
else AOF Disabled
Service->>Log: Log skip message
end
Service-->>App: Complete
sequenceDiagram
participant Client as Client
participant Controller as UserPolicyController
participant Service as UserPolicyService
participant Mapper as RepeatBlockMapper
participant DB as Database
participant Cache as Redis Cache
participant Audit as AuditHistory
Client->>Controller: PATCH /api/policies/lines/repeat-block/enable-toggles
Controller->>Service: toggleRepeatBlockPolicy(id, request, auth)
Service->>Mapper: Fetch repeat block by id
Mapper->>DB: SELECT repeat_block
DB-->>Mapper: Block record
Mapper-->>Service: Block data
Service->>Service: Validate family-group access
Service->>Service: Toggle isActive state
Service->>Mapper: updateIsActive(id, isActive)
Mapper->>DB: UPDATE is_active, updated_at
DB-->>Mapper: Success
Mapper-->>Service: Rows affected
Service->>Audit: Create alarm history
Audit->>DB: INSERT alarm record
Service->>Cache: Refresh blocks (write-through)
Cache-->>Service: ACK
Service->>Audit: Log policy history
Audit->>DB: INSERT history record
Service->>Controller: Return BlockPolicyResDto
Controller-->>Client: 200 OK (updated policy)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
개요
관련 BackLog
Resolves: (Backlog Number, ...)
PR 유형
PR Checklist
Summary by CodeRabbit
New Features
Documentation
Tests