Skip to content

Commit

Permalink
opt: not allocation when localsession is disabled (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
AsterDY authored Oct 11, 2024
1 parent 4b1853b commit bfce75f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backup/metainfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ func RecoverCtxOnDemands(ctx context.Context, handler BackupHandler) context.Con

// Set current Sessioin
func BackupCtx(ctx context.Context) {
if localsession.GetDefaultManager() == nil {
return
}
localsession.BindSession(localsession.NewSessionCtx(ctx))
}

Expand Down
5 changes: 5 additions & 0 deletions gls.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ func DefaultManagerOptions() ManagerOptions {
}
}

// GetDefaultManager returns the default manager
func GetDefaultManager() *SessionManager {
return defaultManagerObj
}

// InitDefaultManager update and restart default manager.
// It accept argument opts and env config both.
//
Expand Down

0 comments on commit bfce75f

Please sign in to comment.