Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Explain why we manually publish state #351

Merged
merged 1 commit into from
Apr 19, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,14 @@ func (a *Agent) LoadJob(j *job.Job) {

a.systemd.LoadJob(j)

//TODO(bcwaldon): Investigate whether or not this manual
// fetching of the payload state is necessary.
// We must explicitly refresh the payload state, as the dbus
// event listener does not send an event when we write a unit
// file to disk.
ps, err := a.systemd.GetPayloadState(j.Name)
if err != nil {
log.Errorf("Failed fetching state of Job(%s)", j.Name)
log.Errorf("Failed fetching state of Payload(%s)", j.Name)
return
}

a.ReportPayloadState(j.Name, ps)
}

Expand Down Expand Up @@ -274,6 +274,10 @@ func (a *Agent) UnloadJob(jobName string) {

a.ForgetJob(jobName)
a.systemd.UnloadJob(jobName)

// The dbus event systemd will not trigger an event telling
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really? why doesn't UnitRemoved get triggered?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go-systemd isn't listening for UnitRemoved.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh nuts to go-systemd.

// us that the unit has been unloaded, so we must explicitly
// clear what is in the Registry.
a.ReportPayloadState(jobName, nil)

// Trigger rescheduling of all the peers of the job that was just unloaded
Expand Down