trimming garbage code from file

main
KeeganForelight 1 year ago
parent 25f75e705c
commit 28ceb0cc31

@ -18,11 +18,11 @@ import (
type Manager interface { type Manager interface {
Start() error // status checks Start() error // status checks
Exit() error Stop() error
Timeout() (time.Duration, error) // TO Generator Timeout() (time.Duration, error) // TO Generator
} }
func NewManager(max int) Manager { func NewManager(max int) (Manager, error) {
// takes a heartbeat and max connection attempts // takes a heartbeat and max connection attempts
return manager.New(max) return manager.New(max)
} }
@ -37,30 +37,31 @@ type ReactorManager struct {
Err chan error Err chan error
} }
func NewReactorManager(cl *Client, config *viper.Viper, errCh chan error) *ReactorManager { func NewReactorManager(cl *Client,
config *viper.Viper,
errCh chan error,
) (*ReactorManager, error) {
// making managers // making managers
m := NewManager(6) m, err := NewManager(6)
r := &ReactorManager{ r := &ReactorManager{
Manager: m, Manager: m,
Client: cl, Client: cl,
Config: config, Config: config,
Err: errCh, Err: errCh,
} }
return r return r, err
} }
func (r *ReactorManager) Start() error { func (r *ReactorManager) Start() error {
// allows for extra stuff // allows for extra stuff
logging.Debug(logging.DStart, "RMA %v starting", r.Id) logging.Debug(logging.DStart, "RMA %v starting", r.Id)
return r.Manager.Start() return r.Manager.Start()
//go r.StatusMon.Send(&DeviceInfo{Id: r.Id, Type: "Reactor", Status: "[green]ONLINE[white]"}, "Reactor")
} }
func (r *ReactorManager) Exit() error { func (r *ReactorManager) Exit() error {
// allows for extra stuff // allows for extra stuff
logging.Debug(logging.DExit, "RMA %v exiting", r.Id) logging.Debug(logging.DExit, "RMA %v exiting", r.Id)
return r.Manager.Exit() return r.Manager.Exit()
//go r.StatusMon.Send(&DeviceInfo{Id: r.Id, Type: "Reactor", Status: "[red]OFFLINE[white]", Data: fmt.Sprintf("Last Seen %v", time.Now().Format("Mon at 03:04:05pm MST"))}, "Reactor")
} }
func (r *ReactorManager) UpdateClient(cl *Client) error { func (r *ReactorManager) UpdateClient(cl *Client) error {
@ -72,7 +73,6 @@ func (r *ReactorManager) UpdateClient(cl *Client) error {
func (r *ReactorManager) ReactorStatusHandler(ctx context.Context, req *pb.ReactorStatusPing) (*pb.ReactorStatusResponse, error) { func (r *ReactorManager) ReactorStatusHandler(ctx context.Context, req *pb.ReactorStatusPing) (*pb.ReactorStatusResponse, error) {
// function client will call to update reactor information // function client will call to update reactor information
//go r.PingReset()
fmt.Printf("Recieved ping from %d!\n", req.GetId()) fmt.Printf("Recieved ping from %d!\n", req.GetId())
// update devices/sensors // update devices/sensors
for _, dev := range req.GetDevices() { for _, dev := range req.GetDevices() {

Loading…
Cancel
Save