Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
748178d2
Commit
748178d2
authored
Aug 10, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make tx run in parallel
parent
980856e4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
17 deletions
+11
-17
txRunner.js
src/app/execution/txRunner.js
+11
-17
No files found.
src/app/execution/txRunner.js
View file @
748178d2
...
...
@@ -14,31 +14,17 @@ function TxRunner (executionContext, vmaccounts, opts) {
if
(
this
.
executionContext
.
isVM
())
{
this
.
blockNumber
=
1150000
// The VM is running in Homestead mode, which started at this block.
}
this
.
running
=
false
this
.
pendingTxs
=
[]
this
.
pendingTxs
=
{}
this
.
vmaccounts
=
vmaccounts
}
TxRunner
.
prototype
.
rawRun
=
function
(
args
,
cb
)
{
this
.
pendingTxs
.
push
({
tx
:
args
,
cb
:
cb
})
this
.
execute
()
run
(
this
,
args
,
Date
.
now
(),
cb
)
}
TxRunner
.
prototype
.
execute
=
function
()
{
TxRunner
.
prototype
.
execute
=
function
(
args
,
callback
)
{
var
self
=
this
if
(
this
.
running
||
this
.
pendingTxs
.
length
===
0
)
{
return
}
var
args
=
this
.
pendingTxs
[
0
].
tx
var
cb
=
this
.
pendingTxs
[
0
].
cb
this
.
pendingTxs
.
shift
()
var
callback
=
function
(
error
,
result
)
{
cb
(
error
,
result
)
self
.
running
=
false
self
.
execute
()
}
this
.
running
=
true
var
from
=
args
.
from
var
to
=
args
.
to
var
data
=
args
.
data
...
...
@@ -153,4 +139,12 @@ function tryTillResponse (web3, txhash, done) {
})
}
function
run
(
self
,
tx
,
stamp
,
callback
)
{
self
.
pendingTxs
[
stamp
]
=
tx
self
.
execute
(
tx
,
(
error
,
result
)
=>
{
delete
self
.
pendingTxs
[
stamp
]
callback
(
error
,
result
)
})
}
module
.
exports
=
TxRunner
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