feat(daemon): add auto_pull config parameter for periodic remote sync
Add --auto-pull flag to control whether the daemon periodically pulls from remote to check for updates from other clones. Configuration precedence: 1. --auto-pull CLI flag (highest) 2. BEADS_AUTO_PULL environment variable 3. daemon.auto_pull in database config 4. Default: true when sync.branch is configured When auto_pull is enabled, the daemon creates a remoteSyncTicker that periodically calls doAutoImport() to pull remote changes. When disabled, users must manually run 'git pull' to sync remote changes. Changes: - cmd/bd/daemon.go: Add --auto-pull flag and config reading logic - cmd/bd/daemon_event_loop.go: Gate remoteSyncTicker on autoPull parameter - cmd/bd/daemon_lifecycle.go: Add auto-pull to status output and spawn args - internal/rpc/protocol.go: Add AutoPull field to StatusResponse - internal/rpc/server_core.go: Add autoPull to Server struct and SetConfig - internal/rpc/server_routing_validation_diagnostics.go: Include in status - Tests updated to pass autoPull parameter Closes #TBD
This commit is contained in:
@@ -97,7 +97,7 @@ func TestStatusEndpointWithConfig(t *testing.T) {
|
||||
server := NewServer(socketPath, store, tmpDir, dbPath)
|
||||
|
||||
// Set config before starting
|
||||
server.SetConfig(true, true, false, "10s", "events")
|
||||
server.SetConfig(true, true, true, false, "10s", "events")
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
@@ -155,7 +155,7 @@ func TestStatusEndpointLocalMode(t *testing.T) {
|
||||
server := NewServer(socketPath, store, tmpDir, dbPath)
|
||||
|
||||
// Set config for local mode
|
||||
server.SetConfig(false, false, true, "5s", "poll")
|
||||
server.SetConfig(false, false, false, true, "5s", "poll")
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
@@ -284,7 +284,7 @@ func TestSetConfigConcurrency(t *testing.T) {
|
||||
done := make(chan bool)
|
||||
for i := 0; i < 10; i++ {
|
||||
go func(n int) {
|
||||
server.SetConfig(n%2 == 0, n%3 == 0, n%4 == 0, "5s", "events")
|
||||
server.SetConfig(n%2 == 0, n%3 == 0, n%5 == 0, n%4 == 0, "5s", "events")
|
||||
done <- true
|
||||
}(i)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user