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
6775a82c
Commit
6775a82c
authored
Jun 07, 2018
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes typo in code
parent
1bd31aa3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
pkg/bus/bus.go
+3
-3
pkg/services/sqlstore/sqlstore.go
+7
-5
No files found.
pkg/bus/bus.go
View file @
6775a82c
...
...
@@ -13,7 +13,7 @@ type Msg interface{}
var
ErrHandlerNotFound
=
errors
.
New
(
"handler not found"
)
type
TransactionWrapper
interface
{
Wrap
p
(
ctx
context
.
Context
,
fn
func
(
ctx
context
.
Context
)
error
)
error
Wrap
(
ctx
context
.
Context
,
fn
func
(
ctx
context
.
Context
)
error
)
error
}
type
Bus
interface
{
...
...
@@ -39,7 +39,7 @@ type Bus interface {
}
func
(
b
*
InProcBus
)
InTransaction
(
ctx
context
.
Context
,
fn
func
(
ctx
context
.
Context
)
error
)
error
{
return
b
.
transactionWrapper
.
Wrap
p
(
ctx
,
fn
)
return
b
.
transactionWrapper
.
Wrap
(
ctx
,
fn
)
}
type
InProcBus
struct
{
...
...
@@ -213,6 +213,6 @@ func ClearBusHandlers() {
type
noopTransactionManager
struct
{}
func
(
*
noopTransactionManager
)
Wrap
p
(
ctx
context
.
Context
,
fn
func
(
ctx
context
.
Context
)
error
)
error
{
func
(
*
noopTransactionManager
)
Wrap
(
ctx
context
.
Context
,
fn
func
(
ctx
context
.
Context
)
error
)
error
{
return
nil
}
pkg/services/sqlstore/sqlstore.go
View file @
6775a82c
...
...
@@ -99,11 +99,11 @@ type SQLTransactionManager struct {
engine
*
xorm
.
Engine
}
func
(
stm
*
SQLTransactionManager
)
Wrap
p
(
ctx
context
.
Context
,
fn
func
(
ctx
context
.
Context
)
error
)
error
{
return
stm
.
wrap
p
Internal
(
ctx
,
fn
,
0
)
func
(
stm
*
SQLTransactionManager
)
Wrap
(
ctx
context
.
Context
,
fn
func
(
ctx
context
.
Context
)
error
)
error
{
return
stm
.
wrapInternal
(
ctx
,
fn
,
0
)
}
func
(
stm
*
SQLTransactionManager
)
wrap
p
Internal
(
ctx
context
.
Context
,
fn
func
(
ctx
context
.
Context
)
error
,
retry
int
)
error
{
func
(
stm
*
SQLTransactionManager
)
wrapInternal
(
ctx
context
.
Context
,
fn
func
(
ctx
context
.
Context
)
error
,
retry
int
)
error
{
sess
:=
startSession
(
ctx
)
defer
sess
.
Close
()
...
...
@@ -117,14 +117,16 @@ func (stm *SQLTransactionManager) wrappInternal(ctx context.Context, fn func(ctx
sess
.
Rollback
()
time
.
Sleep
(
time
.
Millisecond
*
time
.
Duration
(
10
))
sqlog
.
Info
(
"Database table locked, sleeping then retrying"
,
"retry"
,
retry
)
return
stm
.
wrap
p
Internal
(
ctx
,
fn
,
retry
+
1
)
return
stm
.
wrapInternal
(
ctx
,
fn
,
retry
+
1
)
}
}
if
err
!=
nil
{
sess
.
Rollback
()
return
err
}
else
if
err
=
sess
.
Commit
();
err
!=
nil
{
}
if
err
=
sess
.
Commit
();
err
!=
nil
{
return
err
}
...
...
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