agent/bill/monitor.go
func (m *Monitor) VerifySuspendedChannelsAndTryToTerminate() error {
	query := `
              SELECT channels.id::text
		FROM channels
                     LEFT JOIN offerings offer
                     ON channels.offering = offer.id

                     INNER JOIN accounts acc
                     ON channels.agent = acc.eth_addr
               WHERE channels.service_status = 'suspended'
                 AND channels.channel_status NOT IN ('pending')
                 AND acc.in_use
                 AND channels.service_changed_time + (offer.max_suspended_time * INTERVAL '1 SECOND') < now();`

	return m.processEachChannel(query, m.terminateService)
}
func (m *Monitor) VerifySuspendedChannelsAndTryToTerminate() error {
	query := `
              SELECT channels.id::text
		FROM channels
                     LEFT JOIN offerings offer
                     ON channels.offering = offer.id

                     INNER JOIN accounts acc
                     ON channels.agent = acc.eth_addr
               WHERE channels.service_status = 'suspended'
                 AND channels.channel_status NOT IN ('pending')
                 AND acc.in_use
                 AND channels.service_changed_time + (offer.max_suspended_time * INTERVAL '1 SECOND') < now();`

	return m.processEachChannel(query, m.terminateService)
}
// VerifySuspendedChannelsAndTryToTerminate scans all suspended channels,
// and terminates those of them, who are staying suspended too long.