diff --git a/internal/app/handler/modem.go b/internal/app/handler/modem.go index 9e0c136..c9b6a4c 100644 --- a/internal/app/handler/modem.go +++ b/internal/app/handler/modem.go @@ -45,10 +45,6 @@ EID: %s } m.Lock() info, err := lpac.NewCmd(context.Background(), usbDevice).Info() - ns, _ := lpac.NewCmd(context.Background(), usbDevice).NotificationList() - for _, n := range ns { - fmt.Println(n.ICCID) - } m.Unlock() if err != nil { slog.Error("failed to get eUICC info", "error", err) diff --git a/internal/pkg/conversation/conversation.go b/internal/pkg/conversation/conversation.go index e074032..6b22f71 100644 --- a/internal/pkg/conversation/conversation.go +++ b/internal/pkg/conversation/conversation.go @@ -29,7 +29,7 @@ var conversationsInstance *conversations func NewConversation(bot *telebot.Bot) *conversations { conversationsInstance = &conversations{ bot: bot, - conversations: make(map[int64]*conversation), + conversations: make(map[int64]*conversation, 10), } conversationsInstance.handleText() return conversationsInstance diff --git a/internal/pkg/modem/manager.go b/internal/pkg/modem/manager.go index 6904510..4d0bdc8 100644 --- a/internal/pkg/modem/manager.go +++ b/internal/pkg/modem/manager.go @@ -25,7 +25,7 @@ type Manager struct { reboot chan struct{} } -var Instance *Manager +var managerInstance *Manager func NewManager() (*Manager, error) { mmgr, err := modemmanager.NewModemManager() @@ -37,18 +37,17 @@ func NewManager() (*Manager, error) { return nil, err } - m := &Manager{ + managerInstance = &Manager{ mmgr: mmgr, - modems: make(map[string]*Modem, 1), + modems: make(map[string]*Modem, 10), reboot: make(chan struct{}, 1), } - go m.watch() - Instance = m - return m, nil + go managerInstance.watch() + return managerInstance, nil } func GetManager() *Manager { - return Instance + return managerInstance } func (m *Manager) watch() error { @@ -57,7 +56,7 @@ func (m *Manager) watch() error { slog.Error("failed to watch modems", "error", err) panic(err) } - time.Sleep(5 * time.Second) + time.Sleep(1 * time.Second) } }