🔊 Add log in pushing websocket command
This commit is contained in:
parent
614509740b
commit
fce42e4557
@ -3,6 +3,7 @@ package services
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.solsynth.dev/hypernet/nexus/pkg/nex"
|
"git.solsynth.dev/hypernet/nexus/pkg/nex"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
@ -16,10 +17,14 @@ func PushCommand(userId uint, task nex.WebSocketPackage) {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
pc := gap.Nx.GetNexusGrpcConn()
|
pc := gap.Nx.GetNexusGrpcConn()
|
||||||
_, _ = proto.NewStreamServiceClient(pc).PushStream(ctx, &proto.PushStreamRequest{
|
_, err := proto.NewStreamServiceClient(pc).PushStream(ctx, &proto.PushStreamRequest{
|
||||||
UserId: lo.ToPtr(uint64(userId)),
|
UserId: lo.ToPtr(uint64(userId)),
|
||||||
Body: task.Marshal(),
|
Body: task.Marshal(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Warn().Err(err).Msg("Failed to push websocket command to nexus...")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func PushCommandBatch(userId []uint64, task nex.WebSocketPackage) {
|
func PushCommandBatch(userId []uint64, task nex.WebSocketPackage) {
|
||||||
@ -27,8 +32,12 @@ func PushCommandBatch(userId []uint64, task nex.WebSocketPackage) {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
pc := gap.Nx.GetNexusGrpcConn()
|
pc := gap.Nx.GetNexusGrpcConn()
|
||||||
_, _ = proto.NewStreamServiceClient(pc).PushStreamBatch(ctx, &proto.PushStreamBatchRequest{
|
_, err := proto.NewStreamServiceClient(pc).PushStreamBatch(ctx, &proto.PushStreamBatchRequest{
|
||||||
UserId: userId,
|
UserId: userId,
|
||||||
Body: task.Marshal(),
|
Body: task.Marshal(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Warn().Err(err).Msg("Failed to push websocket command to nexus in batches...")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user