Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
4c5fe68e
Commit
4c5fe68e
authored
Jun 15, 2018
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds inTransactionCtx that calls inTransactionWithRetryCtx
parent
1181e967
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
pkg/services/sqlstore/transactions.go
+4
-0
pkg/services/sqlstore/user.go
+2
-2
No files found.
pkg/services/sqlstore/transactions.go
View file @
4c5fe68e
...
@@ -100,3 +100,7 @@ func inTransactionWithRetryCtx(ctx context.Context, callback dbTransactionFunc,
...
@@ -100,3 +100,7 @@ func inTransactionWithRetryCtx(ctx context.Context, callback dbTransactionFunc,
func
inTransaction
(
callback
dbTransactionFunc
)
error
{
func
inTransaction
(
callback
dbTransactionFunc
)
error
{
return
inTransactionWithRetry
(
callback
,
0
)
return
inTransactionWithRetry
(
callback
,
0
)
}
}
func
inTransactionCtx
(
ctx
context
.
Context
,
callback
dbTransactionFunc
)
error
{
return
inTransactionWithRetryCtx
(
ctx
,
callback
,
0
)
}
pkg/services/sqlstore/user.go
View file @
4c5fe68e
...
@@ -82,7 +82,7 @@ func getOrgIdForNewUser(cmd *m.CreateUserCommand, sess *DBSession) (int64, error
...
@@ -82,7 +82,7 @@ func getOrgIdForNewUser(cmd *m.CreateUserCommand, sess *DBSession) (int64, error
}
}
func
CreateUser
(
ctx
context
.
Context
,
cmd
*
m
.
CreateUserCommand
)
error
{
func
CreateUser
(
ctx
context
.
Context
,
cmd
*
m
.
CreateUserCommand
)
error
{
return
inTransaction
WithRetry
Ctx
(
ctx
,
func
(
sess
*
DBSession
)
error
{
return
inTransactionCtx
(
ctx
,
func
(
sess
*
DBSession
)
error
{
orgId
,
err
:=
getOrgIdForNewUser
(
cmd
,
sess
)
orgId
,
err
:=
getOrgIdForNewUser
(
cmd
,
sess
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -152,7 +152,7 @@ func CreateUser(ctx context.Context, cmd *m.CreateUserCommand) error {
...
@@ -152,7 +152,7 @@ func CreateUser(ctx context.Context, cmd *m.CreateUserCommand) error {
}
}
return
nil
return
nil
}
,
0
)
})
}
}
func
GetUserById
(
query
*
m
.
GetUserByIdQuery
)
error
{
func
GetUserById
(
query
*
m
.
GetUserByIdQuery
)
error
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment