Skip to content

Commit 96d7f91

Browse files
authored
Msgpack Marshal is non deterministic so replace with s.Obj in id generation for constants
1 parent c878b5e commit 96d7f91

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/operator/context/constants.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222

2323
"github.com/cortexlabs/cortex/pkg/api/context"
2424
"github.com/cortexlabs/cortex/pkg/api/resource"
25+
s "github.com/cortexlabs/cortex/pkg/api/strings"
2526
"github.com/cortexlabs/cortex/pkg/api/userconfig"
2627
"github.com/cortexlabs/cortex/pkg/consts"
2728
"github.com/cortexlabs/cortex/pkg/lib/errors"
@@ -49,7 +50,7 @@ func loadConstants(constantConfigs userconfig.Constants) (context.Constants, err
4950
func newConstant(constantConfig userconfig.Constant) (*context.Constant, error) {
5051
var buf bytes.Buffer
5152
buf.WriteString(context.DataTypeID(constantConfig.Type))
52-
buf.Write(msgpack.MustMarshal(constantConfig.Value))
53+
buf.WriteString(s.Obj(constantConfig.Value))
5354
id := hash.Bytes(buf.Bytes())
5455
idWithTags := hash.String(id + constantConfig.Tags.ID())
5556

0 commit comments

Comments
 (0)