Skip to content

Commit 03b03e4

Browse files
committed
fix: generic issue and moved destroy before handle
1 parent 420ddc9 commit 03b03e4

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

dataloader_redis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (r *RedisDataloader[P]) BuryFor(ctx context.Context, payload P, forTimeRang
4848
//
4949
// ZADD sortedSetKey utilUnixMilliTimestamp <capsule base64 string>
5050
func (r *RedisDataloader[P]) BuryUtil(ctx context.Context, payload P, utilUnixMilliTimestamp int64) error {
51-
newCapsule := TimeCapsule[any]{Payload: payload}
51+
newCapsule := TimeCapsule[P]{Payload: payload}
5252
return r.bury(ctx, newCapsule.Base64String(), utilUnixMilliTimestamp)
5353
}
5454

dataloader_rueidis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (r *RueidisDataloader[P]) BuryFor(ctx context.Context, payload P, forTimeRa
4646
//
4747
// ZADD sortedSetKey utilUnixMilliTimestamp <capsule base64 string>
4848
func (r *RueidisDataloader[P]) BuryUtil(ctx context.Context, payload P, utilUnixMilliTimestamp int64) error {
49-
newCapsule := TimeCapsule[any]{Payload: payload}
49+
newCapsule := TimeCapsule[P]{Payload: payload}
5050
return r.bury(ctx, newCapsule.Base64String(), utilUnixMilliTimestamp)
5151
}
5252

timecapsule.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,10 @@ func (t *TimeCapsuleDigger[P]) Start() {
153153

154154
t.logger.Debugf("[TimeCapsule] dug a new capsule from dataloader %v", t.dataloader.Type())
155155

156-
assertedCapsule, ok := any(dugCapsule).(*TimeCapsule[P])
157-
if ok && t.handlerFunc != nil && assertedCapsule != nil {
158-
t.handlerFunc(t, assertedCapsule)
159-
}
160-
161156
t.destroy(dugCapsule)
157+
if t.handlerFunc != nil {
158+
t.handlerFunc(t, dugCapsule)
159+
}
162160
case <-ctx.Done():
163161
return
164162
default:

0 commit comments

Comments
 (0)