Skip to content

Commit

Permalink
feat: add StatusAt field in update event
Browse files Browse the repository at this point in the history
  • Loading branch information
ironman0x7b2 committed Jul 15, 2024
1 parent 6278a21 commit be8450c
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 30 deletions.
1 change: 1 addition & 0 deletions proto/sentinel/session/v3/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ message EventUpdateStatus {
string acc_address = 2;
string node_address = 3;
sentinel.types.v1.Status status = 4;
string status_at = 5;
}
1 change: 1 addition & 0 deletions x/session/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func (k *Keeper) handleInactiveSessions(ctx sdk.Context) {
AccAddress: item.GetAccAddress(),
NodeAddress: item.GetNodeAddress(),
Status: v1base.StatusInactive,
StatusAt: ctx.BlockTime().String(),
},
)

Expand Down
1 change: 1 addition & 0 deletions x/session/keeper/msg_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func (k *Keeper) HandleMsgCancelSession(ctx sdk.Context, msg *v3.MsgCancelSessio
AccAddress: session.GetAccAddress(),
NodeAddress: session.GetNodeAddress(),
Status: session.GetStatus(),
StatusAt: session.GetStatusAt().String(),
},
)

Expand Down
105 changes: 75 additions & 30 deletions x/session/types/v3/events.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions x/session/types/v3/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Session interface {
GetInactiveAt() time.Time
GetNodeAddress() string
GetStatus() v1base.Status
GetStatusAt() time.Time
GetUploadBytes() sdkmath.Int

SetDownloadBytes(sdkmath.Int)
Expand Down
1 change: 1 addition & 0 deletions x/subscription/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func (k *Keeper) handleInactiveSubscriptions(ctx sdk.Context) {
PlanID: item.PlanID,
AccAddress: item.AccAddress,
Status: v1base.StatusInactive,
StatusAt: ctx.BlockTime().String(),
},
)

Expand Down

0 comments on commit be8450c

Please sign in to comment.