채널이름 고정으로 계산
This commit is contained in:
@ -3,7 +3,9 @@ package rpc
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/md5"
|
||||
"encoding/gob"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"path"
|
||||
@ -55,7 +57,12 @@ func Start(ctx context.Context, redisClient *redis.Client) {
|
||||
return
|
||||
}
|
||||
|
||||
pubsubName := primitive.NewObjectID().Hex()[6:]
|
||||
hash := md5.New()
|
||||
for k := range engine.receivers {
|
||||
hash.Write([]byte(k))
|
||||
}
|
||||
pubsubName := hex.EncodeToString(hash.Sum(nil))[:16]
|
||||
|
||||
engine.publish = func(s []byte) error {
|
||||
_, err := redisClient.Publish(ctx, pubsubName, s).Result()
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user