diff options
Diffstat (limited to 'models/lfs_lock.go')
-rw-r--r-- | models/lfs_lock.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/models/lfs_lock.go b/models/lfs_lock.go index 247444a66d..943699290f 100644 --- a/models/lfs_lock.go +++ b/models/lfs_lock.go @@ -105,18 +105,16 @@ func GetLFSLockByID(id int64) (*LFSLock, error) { // GetLFSLockByRepoID returns a list of locks of repository. func GetLFSLockByRepoID(repoID int64, page, pageSize int) ([]*LFSLock, error) { - sess := db.NewSession(db.DefaultContext) - defer sess.Close() - + e := db.GetEngine(db.DefaultContext) if page >= 0 && pageSize > 0 { start := 0 if page > 0 { start = (page - 1) * pageSize } - sess.Limit(pageSize, start) + e.Limit(pageSize, start) } lfsLocks := make([]*LFSLock, 0, pageSize) - return lfsLocks, sess.Find(&lfsLocks, &LFSLock{RepoID: repoID}) + return lfsLocks, e.Find(&lfsLocks, &LFSLock{RepoID: repoID}) } // CountLFSLockByRepoID returns a count of all LFSLocks associated with a repository. |