FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
engine/dispatch.js at master · node-app-engine/engine · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
node-app-engine
/
engine
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
engine
/
dispatch.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
74 lines (57 loc) · 1.96 KB
Breadcrumbs
engine
/
dispatch.js
Copy path
File metadata and controls
74 lines (57 loc) · 1.96 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* vim: set expandtab tabstop=2 shiftwidth=2 foldmethod=marker: */
"use strict"
;
var
fs
=
require
(
'fs'
)
;
var
util
=
require
(
'util'
)
;
var
Builder
=
require
(
'build4js'
)
;
var
Path
=
require
(
'path'
)
;
var
Home
=
__dirname
;
var
_props
=
Home
+
'/default.properties'
;
if
(
process
.
argv
.
length
>
2
)
{
_props
=
Path
.
normalize
(
process
.
argv
[
2
]
)
;
}
if
(
!
(
fs
.
existsSync
||
Path
.
existsSync
)
(
_props
)
)
{
console
.
log
(
'Property file ('
+
_props
+
') not found.'
)
;
process
.
exit
(
1
)
;
}
var
_me
=
Builder
.
create
(
_props
,
Home
)
;
Builder
.
fileset
(
Home
+
'/build/tpl'
,
/
\.
(
i
n
i
|
t
x
t
)
$
/
,
function
(
fn
)
{
var
f
=
_me
.
compile
(
fn
.
full
,
'etc/'
+
fn
.
base
,
{
'dir.root'
:
Home
}
)
;
Builder
.
syntax
(
f
)
.
forEach
(
function
(
k
)
{
throw
new
Error
(
'Found undefined token "'
+
k
+
'" in "'
+
f
+
'"'
)
;
}
)
;
fn
.
setmode
(
384
,
f
)
;
/**< 0600 */
}
)
;
var
log
=
require
(
'filelog'
)
.
create
(
{
'file'
:
_me
.
get
(
'log.root'
,
Home
+
'/log'
)
+
'/master.log'
,
}
)
;
var
cfg
=
require
(
'configer'
)
.
create
(
Home
+
'/etc/master.ini'
)
;
var
app
=
require
(
'pm'
)
.
createMaster
(
cfg
.
get
(
'master'
,
{
'pidfile'
:
Home
+
'/run/mosad.pid'
,
}
)
)
;
app
.
on
(
'giveup'
,
function
(
name
,
n
,
p
)
{
log
.
warn
(
util
.
format
(
'max fatals reached (%d), give up to fork: name=%s pause=%d'
,
n
,
name
,
p
)
)
;
}
)
;
app
.
on
(
'signal'
,
function
(
signal
,
name
)
{
log
.
notice
(
util
.
format
(
'Got signal (%d) as %s'
,
signal
,
name
)
)
;
}
)
;
app
.
on
(
'fork'
,
function
(
name
,
pid
)
{
log
.
notice
(
util
.
format
(
'new worker forked: name=%s pid=%d'
,
name
,
pid
)
)
;
}
)
;
app
.
on
(
'quit'
,
function
(
name
,
pid
,
code
,
signal
)
{
log
.
notice
(
util
.
format
(
'child quit: name=%s pid=%d code=%d signal=%s'
,
name
,
pid
,
code
,
signal
)
)
;
}
)
;
var
workers
=
cfg
.
find
(
'worker'
)
;
var
args
;
for
(
var
group
in
workers
)
{
if
(
group
&&
workers
[
group
]
.
script
)
{
args
=
[
group
,
workers
[
group
]
.
script
,
workers
[
group
]
]
;
if
(
workers
[
group
]
.
argument
)
{
// ToDo: 多个参数和引号的处理
args
.
push
(
[
workers
[
group
]
.
argument
]
)
;
}
app
.
register
.
apply
(
app
,
args
)
;
}
}
app
.
dispatch
(
)
;
Back
|
FazBrowse Home
|
New Git URL