Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
T
tangled
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eriksson monteiro
tangled
Commits
9e2dddfb
Commit
9e2dddfb
authored
Aug 19, 2021
by
Eriksson Monteiro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update millix-node v1.11.3
parent
c0d769d5
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
150 additions
and
157 deletions
+150
-157
millix_node/README.md
millix_node/README.md
+1
-1
millix_node/core/config/config.js
millix_node/core/config/config.js
+5
-3
millix_node/core/console.js
millix_node/core/console.js
+2
-0
millix_node/core/task.js
millix_node/core/task.js
+7
-1
millix_node/core/wallet/wallet-transaction-consensus.js
millix_node/core/wallet/wallet-transaction-consensus.js
+1
-1
millix_node/database/repositories/transaction.js
millix_node/database/repositories/transaction.js
+52
-67
millix_node/index.js
millix_node/index.js
+1
-1
millix_node/job/job-engine.js
millix_node/job/job-engine.js
+81
-83
No files found.
millix_node/README.md
View file @
9e2dddfb
...
...
@@ -2,7 +2,7 @@
<br>
<a
href=
"#"
><img
src=
"https://github.com/millix/millix-wallet/blob/master/app/icon.png?raw=true"
alt=
"millix node"
width=
"200"
></a>
<br>
millix node
<small>
v1.11.
2
</small>
millix node
<small>
v1.11.
3
</small>
<br>
</h1>
...
...
millix_node/core/config/config.js
View file @
9e2dddfb
...
...
@@ -774,8 +774,8 @@ export const NETWORK_SHORT_TIME_WAIT_MAX = 1500;
export
const
DATABASE_ENGINE
=
'
sqlite
'
;
export
const
DATABASE_CONNECTION
=
{};
export
const
MILLIX_CIRCULATION
=
9
e15
;
export
const
NODE_MILLIX_BUILD_DATE
=
1629
213000
;
export
const
NODE_MILLIX_VERSION
=
'
1.11.
2
-tangled
'
;
export
const
NODE_MILLIX_BUILD_DATE
=
1629
385375
;
export
const
NODE_MILLIX_VERSION
=
'
1.11.
3
-tangled
'
;
export
const
DATA_BASE_DIR_MAIN_NETWORK
=
'
./millix-tangled
'
;
export
const
DATA_BASE_DIR_TEST_NETWORK
=
'
./millix-tangled
'
;
let
DATA_BASE_DIR
=
MODE_TEST_NETWORK
?
DATA_BASE_DIR_TEST_NETWORK
:
DATA_BASE_DIR_MAIN_NETWORK
;
...
...
@@ -786,6 +786,7 @@ export const WALLET_KEY_PATH = DATA_BASE_DIR +
export
const
JOB_CONFIG_PATH
=
DATA_BASE_DIR
+
'
/job.json
'
;
export
const
JOB_CONFIG_VERSION
=
4
;
export
const
SHARD_ZERO_NAME
=
'
shard_zero
'
;
export
const
DEBUG_LOG_FILTER
=
[];
export
const
PEER_ROTATION_MORE_THAN_AVERAGE
=
0.5
;
export
const
PEER_ROTATION_MORE_THAN_MOST
=
0.2
;
export
const
PEER_ROTATION_MORE_THAN_ALL
=
0.01
;
...
...
@@ -893,5 +894,6 @@ export default {
PEER_ROTATION_MORE_THAN_ALL
,
PEER_ROTATION_CONFIG
,
JOB_CONFIG_PATH
,
JOB_CONFIG_VERSION
JOB_CONFIG_VERSION
,
DEBUG_LOG_FILTER
};
millix_node/core/console.js
View file @
9e2dddfb
...
...
@@ -19,4 +19,6 @@ console.log = function() {
enabled
&&
showLog
&&
config
.
MODE_DEBUG
&&
_consoleLog
.
apply
(
console
,
arguments
);
};
config
.
DEBUG_LOG_FILTER
.
forEach
(
filter
=>
console
.
addFilter
(
filter
));
export
default
console
;
millix_node/core/task.js
View file @
9e2dddfb
...
...
@@ -29,7 +29,13 @@ class Task {
});
}
else
{
try
{
task
();
}
catch
(
e
)
{
this
.
debug
&&
console
.
log
(
`[task] error running task
${
taskName
}
:
${
e
}
`
);
}
if
(
!
once
)
{
self
.
runningTask
[
taskName
]
=
setTimeout
(
run
,
waitTime
);
}
...
...
millix_node/core/wallet/wallet-transaction-consensus.js
View file @
9e2dddfb
...
...
@@ -225,7 +225,7 @@ export class WalletTransactionConsensus {
message
:
`not validated in a depth of
${
depth
}
`
});
}
else
if
(
transaction
.
status
===
2
||
database
.
getRepository
(
'
transaction
'
).
isExpired
(
transaction
.
transaction_date
))
{
else
if
(
transaction
&&
(
transaction
.
status
===
2
||
database
.
getRepository
(
'
transaction
'
).
isExpired
(
transaction
.
transaction_date
)
))
{
return
reject
({
cause
:
'
transaction_validation_max_depth
'
,
transaction_id_fail
:
transactionID
,
...
...
millix_node/database/repositories/transaction.js
View file @
9e2dddfb
This diff is collapsed.
Click to expand it.
millix_node/index.js
View file @
9e2dddfb
...
...
@@ -108,4 +108,4 @@ db.initialize()
});
}
});
//millix v1.11.
2
-tangled
//millix v1.11.
3
-tangled
millix_node/job/job-engine.js
View file @
9e2dddfb
...
...
@@ -19,6 +19,8 @@ import os from 'os';
class
JobEngine
{
static
JOB_WAIT_TIME
=
1000
;
constructor
()
{
this
.
debug
=
false
;
this
.
configJobEngine
=
null
;
...
...
@@ -93,21 +95,26 @@ class JobEngine {
this
.
debug
&&
console
.
log
(
`[job-engine] running job
${
job
.
job_id
}
:
${
job
.
job_name
}
`
);
let
unlocked
=
false
;
const
timestampBegin
=
ntp
.
now
();
this
.
jobRepository
.
updateJobProgressStatus
(
job
.
job_id
,
1
,
{
last_date_begin
:
timestampBegin
})
const
payload
=
JSON
.
parse
(
job
.
job_payload
);
const
module
=
payload
?
this
.
modules
[
payload
.
module
]
:
undefined
;
return
this
.
jobRepository
.
updateJobProgressStatus
(
job
.
job_id
,
1
,
{
last_date_begin
:
timestampBegin
})
.
then
(()
=>
this
.
jobRepository
.
lockJobObject
(
job
.
job_id
))
.
then
(()
=>
{
unlock
();
unlocked
=
true
;
// run job
if
(
job
.
job_type_id
===
this
.
types
[
'
function
'
])
{
const
payload
=
JSON
.
parse
(
job
.
job_payload
);
const
module
=
this
.
modules
[
payload
.
module
];
this
.
debug
&&
console
.
log
(
`[job-engine] running function
${
payload
.
module
}
:
${
payload
.
function_name
}
`
);
if
(
!
module
||
!
payload
||
!
module
[
payload
.
function_name
])
{
return
Promise
.
reject
(
'
job_invalid
'
);
}
let
postJob
=
()
=>
{
const
timestampEnd
=
ntp
.
now
();
const
lastElapse
=
timestampEnd
.
getTime
()
-
timestampBegin
.
getTime
();
this
.
debug
&&
console
.
log
(
`[job-engine] done
${
payload
.
module
}
:
${
payload
.
function_name
}
-
${
lastElapse
}
ms`
);
return
new
Promise
((
resolve
,
reject
)
=>
{
mutex
.
lock
([
'
job-engine
'
],
(
unlockUpdate
)
=>
{
this
.
jobRepository
.
updateJobProgressStatus
(
job
.
job_id
,
0
,
{
last_date_end
:
timestampEnd
,
...
...
@@ -116,45 +123,29 @@ class JobEngine {
})
.
then
(()
=>
this
.
jobRepository
.
unlockJobObject
(
job
.
job_id
))
.
then
(()
=>
{
this
.
processorsStatus
[
processorTag
][
'
running
'
]
=
false
;
unlockUpdate
();
this
.
running
&&
task
.
scheduleTask
(
processorTag
,
this
.
_getTask
.
bind
(
this
,
processorTag
,
processorID
),
500
,
false
,
true
);
resolve
(
);
})
.
catch
(()
=>
{
this
.
processorsStatus
[
processorTag
][
'
running
'
]
=
false
;
unlockUpdate
();
this
.
running
&&
task
.
scheduleTask
(
processorTag
,
this
.
_getTask
.
bind
(
this
,
processorTag
,
processorID
),
500
,
false
,
true
);
reject
();
});
});
});
};
module
[
payload
.
function_name
]()
return
module
[
payload
.
function_name
]()
.
then
(
postJob
)
.
catch
(
postJob
);
}
else
{
mutex
.
lock
([
'
job-engine
'
],
(
unlockUpdate
)
=>
{
this
.
jobRepository
.
updateJobProgressStatus
(
job
.
job_id
,
0
,
{
last_date_end
:
ntp
.
now
(),
last_elapse
:
0
,
last_response
:
'
fail
'
})
.
then
(()
=>
this
.
jobRepository
.
unlockJobObject
(
job
.
job_id
))
.
then
(()
=>
{
this
.
processorsStatus
[
processorTag
][
'
running
'
]
=
false
;
unlockUpdate
();
this
.
running
&&
task
.
scheduleTask
(
processorTag
,
this
.
_getTask
.
bind
(
this
,
processorTag
,
processorID
),
500
,
false
,
true
);
})
.
catch
(()
=>
{
this
.
processorsStatus
[
processorTag
][
'
running
'
]
=
false
;
unlockUpdate
();
this
.
running
&&
task
.
scheduleTask
(
processorTag
,
this
.
_getTask
.
bind
(
this
,
processorTag
,
processorID
),
500
,
false
,
true
);
});
});
return
Promise
.
reject
(
'
job_not_supported
'
);
}
})
.
catch
(()
=>
{
const
timestampEnd
=
ntp
.
now
();
const
lastElapse
=
timestampEnd
.
getTime
()
-
timestampBegin
.
getTime
();
this
.
debug
&&
console
.
log
(
`[job-engine] done
${
payload
.
module
}
:
${
payload
.
function_name
}
-
${
lastElapse
}
ms`
);
mutex
.
lock
([
'
job-engine
'
],
(
unlockUpdate
)
=>
{
let
postJob
=
()
=>
{
this
.
processorsStatus
[
processorTag
][
'
running
'
]
=
false
;
...
...
@@ -162,7 +153,7 @@ class JobEngine {
if
(
!
unlocked
)
{
unlock
();
}
this
.
running
&&
task
.
scheduleTask
(
processorTag
,
this
.
_getTask
.
bind
(
this
,
processorTag
,
processorID
),
500
,
false
,
true
);
this
.
running
&&
task
.
scheduleTask
(
processorTag
,
this
.
_getTask
.
bind
(
this
,
processorTag
,
processorID
),
JobEngine
.
JOB_WAIT_TIME
,
false
,
true
);
};
this
.
jobRepository
...
...
@@ -178,10 +169,17 @@ class JobEngine {
});
}
else
{
return
Promise
.
reject
(
'
job_not_found
'
);
}
})
.
then
(()
=>
{
this
.
processorsStatus
[
processorTag
][
'
running
'
]
=
false
;
unlock
();
this
.
running
&&
task
.
scheduleTask
(
processorTag
,
this
.
_getTask
.
bind
(
this
,
processorTag
,
processorID
),
500
,
false
,
true
);
}
})
.
catch
(()
=>
{
this
.
processorsStatus
[
processorTag
][
'
running
'
]
=
false
;
unlock
();
this
.
running
&&
task
.
scheduleTask
(
processorTag
,
this
.
_getTask
.
bind
(
this
,
processorTag
,
processorID
),
JobEngine
.
JOB_WAIT_TIME
,
false
,
true
);
});
});
}
...
...
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