Major integrations and fixes: - Added BACKBEAT SDK integration for P2P operation timing - Implemented beat-aware status tracking for distributed operations - Added Docker secrets support for secure license management - Resolved KACHING license validation via HTTPS/TLS - Updated docker-compose configuration for clean stack deployment - Disabled rollback policies to prevent deployment failures - Added license credential storage (CHORUS-DEV-MULTI-001) Technical improvements: - BACKBEAT P2P operation tracking with phase management - Enhanced configuration system with file-based secrets - Improved error handling for license validation - Clean separation of KACHING and CHORUS deployment stacks 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
51 lines
749 B
Go
51 lines
749 B
Go
package upgrader
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
func newThreshold(cutoff int) *threshold {
|
|
t := &threshold{
|
|
threshold: cutoff,
|
|
}
|
|
t.cond.L = &t.mu
|
|
return t
|
|
}
|
|
|
|
type threshold struct {
|
|
mu sync.Mutex
|
|
cond sync.Cond
|
|
|
|
count int
|
|
threshold int
|
|
}
|
|
|
|
// Acquire increments the counter. It will not block.
|
|
func (t *threshold) Acquire() {
|
|
t.mu.Lock()
|
|
t.count++
|
|
t.mu.Unlock()
|
|
}
|
|
|
|
// Release decrements the counter.
|
|
func (t *threshold) Release() {
|
|
t.mu.Lock()
|
|
if t.count == 0 {
|
|
panic("negative count")
|
|
}
|
|
if t.threshold == t.count {
|
|
t.cond.Broadcast()
|
|
}
|
|
t.count--
|
|
t.mu.Unlock()
|
|
}
|
|
|
|
// Wait waits for the counter to drop below the threshold
|
|
func (t *threshold) Wait() {
|
|
t.mu.Lock()
|
|
for t.count >= t.threshold {
|
|
t.cond.Wait()
|
|
}
|
|
t.mu.Unlock()
|
|
}
|