| 21 | } |
| 22 | |
| 23 | func (m *GRPCClient) Notify(ctx context.Context, notification *protobufs.Notification) (*protobufs.Empty, error) { |
| 24 | done := make(chan error) |
| 25 | go func() { |
| 26 | _, err := m.client.Notify( |
| 27 | ctx, &protobufs.Notification{Text: notification.GetText(), Name: notification.GetName()}, |
| 28 | ) |
| 29 | done <- err |
| 30 | }() |
| 31 | select { |
| 32 | case err := <-done: |
| 33 | return &protobufs.Empty{}, err |
| 34 | |
| 35 | case <-ctx.Done(): |
| 36 | return &protobufs.Empty{}, errors.New("timeout exceeded") |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | func (m *GRPCClient) Configure(ctx context.Context, config *protobufs.Config) (*protobufs.Empty, error) { |
| 41 | _, err := m.client.Configure(ctx, config) |