Skip to content

Commit 1635269

Browse files
committed
refactor: make CycleSourcesMessage extend CycleMessage
1 parent 731c25e commit 1635269

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

runner/pkg/ibp/client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ func convertWireCycle(msg map[string]interface{}) (CycleSourcesMessage, error) {
161161
}
162162

163163
return CycleSourcesMessage{
164-
Message: Message{
165-
Kind: "CYCLE",
164+
CycleMessage: CycleMessage{
165+
Message: Message{Kind: "CYCLE"},
166+
CycleId: cycleId,
166167
},
167-
CycleId: cycleId,
168168
Sources: sources,
169169
}, nil
170170
}

runner/pkg/ibp/protocol.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ type CycleMessage struct {
7676
}
7777

7878
type CycleSourcesMessage struct {
79-
Message
80-
CycleId int `json:"cycle_id"`
79+
CycleMessage
8180
Sources SourceInfoMap `json:"sources"`
8281
}
8382

@@ -207,8 +206,10 @@ func (p *aspectBazelProtocol) Cycle(changes SourceInfoMap) error {
207206
fmt.Printf("%s Sending cycle #%v (%v changes) to %s\n", color.GreenString("INFO:"), cycle_id, len(changes), p.socketPath)
208207

209208
c := CycleSourcesMessage{
210-
Message: Message{Kind: "CYCLE"},
211-
CycleId: cycle_id,
209+
CycleMessage: CycleMessage{
210+
Message: Message{Kind: "CYCLE"},
211+
CycleId: cycle_id,
212+
},
212213
Sources: changes,
213214
}
214215
if err := p.socket.Send(c); err != nil {

0 commit comments

Comments
 (0)