Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
haoxins committed Apr 8, 2024
1 parent 414fde3 commit cbf61f5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
22 changes: 18 additions & 4 deletions schema_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,17 @@ func (mgr *SchemaManager) ApplyTag(tag LabelSchema) (*ResultSet, error) {

if ttlCol != tag.TTLCol || ttlDuration != tag.TTLDuration {
if mgr.verbose {
log.Printf("ApplyTag: Alter the tag TTL. name=%s, col=%s, duration=%d\n", tag.Name, ttlCol, ttlDuration)
log.Printf(
"ApplyTag: Alter the tag TTL. name=%s, col from %s to %s, duration from %d to %d\n",
tag.Name,
ttlCol,
tag.TTLCol,
ttlDuration,
tag.TTLDuration,
)
}

_, err = mgr.pool.AddTagTTL(tag.Name, ttlCol, ttlDuration)
_, err = mgr.pool.AddTagTTL(tag.Name, tag.TTLCol, tag.TTLDuration)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -236,10 +243,17 @@ func (mgr *SchemaManager) ApplyEdge(edge LabelSchema) (*ResultSet, error) {

if ttlCol != edge.TTLCol || ttlDuration != edge.TTLDuration {
if mgr.verbose {
log.Printf("ApplyEdge: Alter the edge TTL. name=%s, col=%s, duration=%d\n", edge.Name, ttlCol, ttlDuration)
log.Printf(
"ApplyEdge: Alter the edge TTL. name=%s, col from %s to %s, duration from %d to %d\n",
edge.Name,
ttlCol,
edge.TTLCol,
ttlDuration,
edge.TTLDuration,
)
}

_, err = mgr.pool.AddEdgeTTL(edge.Name, ttlCol, ttlDuration)
_, err = mgr.pool.AddEdgeTTL(edge.Name, edge.TTLCol, edge.TTLDuration)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions schema_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ func TestSchemaManagerApplyEdgeWithTTL(t *testing.T) {
if err != nil {
t.Fatal(err)
}
assert.Equal(t, 2, len(labels))
assert.Equal(t, 1, len(labels))
ttlCol, ttlDuration, err := sessionPool.GetEdgeTTL("friend")
if err != nil {
t.Fatal(err)
Expand All @@ -500,7 +500,7 @@ func TestSchemaManagerApplyEdgeWithTTL(t *testing.T) {
if err != nil {
t.Fatal(err)
}
assert.Equal(t, 2, len(labels))
assert.Equal(t, 1, len(labels))
ttlCol, ttlDuration, err = sessionPool.GetEdgeTTL("friend")
if err != nil {
t.Fatal(err)
Expand All @@ -520,7 +520,7 @@ func TestSchemaManagerApplyEdgeWithTTL(t *testing.T) {
if err != nil {
t.Fatal(err)
}
assert.Equal(t, 2, len(labels))
assert.Equal(t, 1, len(labels))
ttlCol, ttlDuration, err = sessionPool.GetEdgeTTL("friend")
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit cbf61f5

Please sign in to comment.