Adjust sync timings for better batching behavior
- Increase flush debounce from 1s to 30s (provides transaction window for batch operations) - Increase daemon poll from 2s to 5s (reduces commit spam) - Agents should run 'bd sync' at end of session to force immediate commit - Prevents creating dozens of commits when making multiple issue changes
This commit is contained in:
@@ -29,7 +29,7 @@ var daemonCmd = &cobra.Command{
|
|||||||
Long: `Run a background daemon that automatically syncs issues with git remote.
|
Long: `Run a background daemon that automatically syncs issues with git remote.
|
||||||
|
|
||||||
The daemon will:
|
The daemon will:
|
||||||
- Poll for changes at configurable intervals (default: 2 seconds)
|
- Poll for changes at configurable intervals (default: 5 seconds)
|
||||||
- Export pending database changes to JSONL
|
- Export pending database changes to JSONL
|
||||||
- Auto-commit changes if --auto-commit flag set
|
- Auto-commit changes if --auto-commit flag set
|
||||||
- Auto-push commits if --auto-push flag set
|
- Auto-push commits if --auto-push flag set
|
||||||
@@ -172,7 +172,7 @@ Use --health to check daemon health and metrics.`,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
daemonCmd.Flags().Duration("interval", 2*time.Second, "Sync check interval")
|
daemonCmd.Flags().Duration("interval", 5*time.Second, "Sync check interval")
|
||||||
daemonCmd.Flags().Bool("auto-commit", false, "Automatically commit changes")
|
daemonCmd.Flags().Bool("auto-commit", false, "Automatically commit changes")
|
||||||
daemonCmd.Flags().Bool("auto-push", false, "Automatically push commits")
|
daemonCmd.Flags().Bool("auto-push", false, "Automatically push commits")
|
||||||
daemonCmd.Flags().Bool("stop", false, "Stop running daemon")
|
daemonCmd.Flags().Bool("stop", false, "Stop running daemon")
|
||||||
|
|||||||
@@ -462,12 +462,12 @@ var rootCmd = &cobra.Command{
|
|||||||
|
|
||||||
// getDebounceDuration returns the auto-flush debounce duration
|
// getDebounceDuration returns the auto-flush debounce duration
|
||||||
// Configurable via config file or BEADS_FLUSH_DEBOUNCE env var (e.g., "500ms", "10s")
|
// Configurable via config file or BEADS_FLUSH_DEBOUNCE env var (e.g., "500ms", "10s")
|
||||||
// Defaults to 1 second if not set or invalid
|
// Defaults to 30 seconds if not set or invalid (provides batching window)
|
||||||
func getDebounceDuration() time.Duration {
|
func getDebounceDuration() time.Duration {
|
||||||
duration := config.GetDuration("flush-debounce")
|
duration := config.GetDuration("flush-debounce")
|
||||||
if duration == 0 {
|
if duration == 0 {
|
||||||
// If parsing failed, use default
|
// If parsing failed, use default
|
||||||
return 1 * time.Second
|
return 30 * time.Second
|
||||||
}
|
}
|
||||||
return duration
|
return duration
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ func Initialize() error {
|
|||||||
_ = v.BindEnv("auto-start-daemon", "BEADS_AUTO_START_DAEMON")
|
_ = v.BindEnv("auto-start-daemon", "BEADS_AUTO_START_DAEMON")
|
||||||
|
|
||||||
// Set defaults for additional settings
|
// Set defaults for additional settings
|
||||||
v.SetDefault("flush-debounce", "1s")
|
v.SetDefault("flush-debounce", "30s")
|
||||||
v.SetDefault("auto-start-daemon", true)
|
v.SetDefault("auto-start-daemon", true)
|
||||||
|
|
||||||
// Read config file if it exists (don't error if not found)
|
// Read config file if it exists (don't error if not found)
|
||||||
|
|||||||
Reference in New Issue
Block a user