Move verbose logger into shared session setup · Entire
Move verbose logger into shared session setup
6f61ee7→main·
Soph·3mo ago·2 files·+11 added/-11 removed
Sessions
8c8385150305View transcript
[?
Can you take a look at the go code (wasm) in /Users/soph/Work/entire/devenv/entire-io-worktree1 based a bit on that I wonder if something like this can be build:Codex·GPT-5.4·1 step](/content/gh/entireio/git-sync/session/019d6d29-8cf7-7fe3-adc9-8c3e4d9d5603#timeline-8c8385150305/index.html)
Changes
docs
Mrewrite-issue-list.md+2/-2
internal/syncer
Msyncer.go+9/-9
339 unmodified lines
340
341
342
343
343
344
345
346
5 unmodified lines
352
353
354
355
355
356
357
358
339 unmodified lines
### 17. Packet parsing allocates too aggressively
Status: open
Status: done
Problem:
- Packet reader allocates per packet and may create unnecessary GC churn.
- Reuse buffers where practical.
Current rewrite note:
- This does not appear to be addressed yet. Packet parsing is cleaner and better tested, but still allocation-heavy.
- `internal/gitproto.PacketReader` now reuses a fixed header buffer and a growable payload buffer, and the rewrite includes packet-reader benchmarks.
## Test Gaps
Mdocs/rewrite-issue-list.md+2/-2
303 unmodified lines
304
305
306
307
308
309
310
18 unmodified lines
329
330
331
332
333
334
335
336
337
338
339
66 unmodified lines
406
407
408
403
409
410
411
412
106 unmodified lines
519
520
521
516
522
523
524
525
116 unmodified lines
642
643
644
645
646
647
648
2 unmodified lines
651
652
653
647
648
649
650
651
652
654
655
656
48 unmodified lines
705
706
707
707
303 unmodified lines
type syncSession struct {
cfg Config
stats *statsCollector
logger *slog.Logger
sourceConn *gitproto.Conn
targetConn *gitproto.Conn
sourceService *gitproto.RefService
stats: newStats(cfg.ShowStats),
measurementDone: startMeasurement(cfg.MeasureMemory),
}
if cfg.Verbose {
logger = slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
Level: slog.LevelInfo,
}))
}
var err error
s.sourceConn, err = newConn(cfg.Source, "source", s.stats)
66 unmodified lines
Measurement: measurementDone(), Protocol: sourceService.Protocol,
}, nil
}
return bootstrapWithInputs(ctx, cfg, stats, sourceConn, targetConn, sourceService, targetAdv, desiredRefs, targetRefMap, reason, measurementDone)
return bootstrapWithInputs(ctx, cfg, stats, s.logger, sourceConn, targetConn, sourceService, targetAdv, desiredRefs, targetRefMap, reason, measurementDone)
}
// Normal sync: allocate in-memory repo and fetch objects
116 unmodified lines
}
_, reason := planner.CanBootstrapRelay(cfg.Force, cfg.Prune, desiredRefs, s.targetRefMap)
result, err := bootstrapWithInputs(ctx, cfg, s.stats, s.sourceConn, s.targetConn, s.sourceService, s.targetAdv, desiredRefs, s.targetRefMap, reason, s.measurementDone)
result, err := bootstrapWithInputs(ctx, cfg, s.stats, s.logger, s.sourceConn, s.targetConn, s.sourceService, s.targetAdv, desiredRefs, s.targetRefMap, reason, s.measurementDone)
result.Measurement = s.measurementDone()
return result, err
}
}
ctx context.Context,
cfg Config,
stats *statsCollector,
logger *slog.Logger,
sourceConn, targetConn *gitproto.Conn,
sourceService *gitproto.RefService,
targetAdv *packp.AdvRefs,
2 unmodified lines
relayReason string,
measurementDone func() Measurement,
) (Result, error) {
var logger *slog.Logger
if cfg.Verbose {
logger = slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
Level: slog.LevelInfo,
}))
}
bResult, err := bstrap.Execute(ctx, bstrap.Params{
SourceConn: sourceConn, TargetConn: targetConn,
SourceService: sourceService, TargetAdv: targetAdv,
48 unmodified lines
})
return count, err
}