-
Notifications
You must be signed in to change notification settings - Fork 11
add egg v4 #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
add egg v4 #25
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||||||||||||
| const egg4 = require('egg4'); | ||||||||||||||||
| const egg3 = require('egg3'); | ||||||||||||||||
| const egg2 = require('egg2'); | ||||||||||||||||
| const egg1 = require('egg1'); | ||||||||||||||||
|
|
@@ -9,9 +10,8 @@ if (workers > 4) { | |||||||||||||||
| workers = 4; | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| if (cluster.isMaster) { | ||||||||||||||||
| if (cluster.isPrimary) { | ||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You've updated
Suggested change
|
||||||||||||||||
| console.log('os version: %s', os.version()); | ||||||||||||||||
| console.log('egg-cluster version: %s', require('egg-cluster/package.json').version); | ||||||||||||||||
|
|
||||||||||||||||
| egg1.startCluster({ | ||||||||||||||||
| workers, | ||||||||||||||||
|
|
@@ -59,6 +59,21 @@ if (cluster.isMaster) { | |||||||||||||||
| reusePort: true, | ||||||||||||||||
| }); | ||||||||||||||||
|
|
||||||||||||||||
| egg4.startCluster({ | ||||||||||||||||
| workers, | ||||||||||||||||
| baseDir: __dirname, | ||||||||||||||||
| port: 7010, | ||||||||||||||||
| framework: 'egg4', | ||||||||||||||||
| }); | ||||||||||||||||
|
|
||||||||||||||||
| egg4.startCluster({ | ||||||||||||||||
| workers, | ||||||||||||||||
| baseDir: __dirname, | ||||||||||||||||
| port: 7011, | ||||||||||||||||
| framework: 'egg4', | ||||||||||||||||
| reusePort: true, | ||||||||||||||||
| }); | ||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These two calls to [
{ port: 7010 },
{ port: 7011, reusePort: true },
].forEach(config => {
egg4.startCluster({
workers,
baseDir: __dirname,
framework: 'egg4',
...config,
});
}); |
||||||||||||||||
|
|
||||||||||||||||
|
||||||||||||||||
| egg4.startCluster({ | |
| workers, | |
| baseDir: __dirname, | |
| port: 7011, | |
| framework: 'egg4', | |
| reusePort: true, | |
| }); |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,9 @@ curl 'http://127.0.0.1:7005/' | |||||||||
| curl 'http://127.0.0.1:7006/' | ||||||||||
| curl 'http://127.0.0.1:7008/' | ||||||||||
| curl 'http://127.0.0.1:7009/' | ||||||||||
| # egg4 | ||||||||||
| curl 'http://127.0.0.1:7010/' | ||||||||||
| curl 'http://127.0.0.1:7011/' | ||||||||||
|
|
||||||||||
| test `tail -c 1 $CSV` && printf "\n" >> $CSV | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the CSV newline append safe when the file doesn’t exist (and quote vars). -test `tail -c 1 $CSV` && printf "\n" >> $CSV
+if [[ -f "$CSV" ]] && [[ -s "$CSV" ]] && [[ "$(tail -c 1 -- "$CSV")" != $'\n' ]]; then
+ printf "\n" >> "$CSV"
+fi📝 Committable suggestion
Suggested change
🧰 Tools🪛 Shellcheck (0.11.0)[warning] 47-47: Quote this to prevent word splitting. (SC2046) 🤖 Prompt for AI Agents |
||||||||||
|
|
||||||||||
|
|
@@ -33,9 +36,9 @@ echo "------- egg3 hello with reusePort=true -------" | |||||||||
| echo "" | ||||||||||
| print_head "egg3" "egg3 hello with reusePort=true" | ||||||||||
| wrk 'http://127.0.0.1:7008/' \ | ||||||||||
| -d 30 \ | ||||||||||
| -d 10 \ | ||||||||||
| -c 50 \ | ||||||||||
| -t 8 \ | ||||||||||
| -t 4 \ | ||||||||||
| --latency \ | ||||||||||
| -s $REPORT | ||||||||||
|
|
||||||||||
|
|
@@ -45,9 +48,9 @@ echo "------- egg3 hello -------" | |||||||||
| echo "" | ||||||||||
| print_head "egg3" "egg3 hello" | ||||||||||
| wrk 'http://127.0.0.1:7005/' \ | ||||||||||
| -d 30 \ | ||||||||||
| -d 10 \ | ||||||||||
| -c 50 \ | ||||||||||
| -t 8 \ | ||||||||||
| -t 4 \ | ||||||||||
| --latency \ | ||||||||||
| -s $REPORT | ||||||||||
|
|
||||||||||
|
|
@@ -57,9 +60,9 @@ echo "------- egg3 hello with worker_threads=1 -------" | |||||||||
| echo "" | ||||||||||
| print_head "egg3" "egg3 hello with worker_threads=1" | ||||||||||
| wrk 'http://127.0.0.1:7006/' \ | ||||||||||
| -d 30 \ | ||||||||||
| -d 10 \ | ||||||||||
| -c 50 \ | ||||||||||
| -t 8 \ | ||||||||||
| -t 4 \ | ||||||||||
| --latency \ | ||||||||||
| -s $REPORT | ||||||||||
|
|
||||||||||
|
|
@@ -69,21 +72,45 @@ echo "------- egg3 hello with worker_threads and reusePort=true -------" | |||||||||
| echo "" | ||||||||||
| print_head "egg3" "egg3 hello with worker_threads and reusePort=true" | ||||||||||
| wrk 'http://127.0.0.1:7009/' \ | ||||||||||
| -d 30 \ | ||||||||||
| -d 10 \ | ||||||||||
| -c 50 \ | ||||||||||
| -t 8 \ | ||||||||||
| -t 4 \ | ||||||||||
| --latency \ | ||||||||||
| -s $REPORT | ||||||||||
|
|
||||||||||
| sleep 5 | ||||||||||
| echo "" | ||||||||||
| echo "------- egg4 hello -------" | ||||||||||
| echo "" | ||||||||||
| print_head "egg4" "egg4 hello" | ||||||||||
| wrk 'http://127.0.0.1:7010/' \ | ||||||||||
| -d 10 \ | ||||||||||
| -c 50 \ | ||||||||||
| -t 4 \ | ||||||||||
| --latency \ | ||||||||||
| -s $REPORT | ||||||||||
|
|
||||||||||
| # sleep 5 | ||||||||||
| # echo "" | ||||||||||
| # echo "------- egg4 hello with reusePort=true -------" | ||||||||||
| # echo "" | ||||||||||
| # print_head "egg4" "egg4 hello with reusePort=true" | ||||||||||
| # wrk 'http://127.0.0.1:7011/' \ | ||||||||||
| # -d 10 \ | ||||||||||
| # -c 50 \ | ||||||||||
| # -t 4 \ | ||||||||||
| # --latency \ | ||||||||||
| # -s $REPORT | ||||||||||
|
Comment on lines
+129
to
+139
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||
|
|
||||||||||
| sleep 5 | ||||||||||
| echo "" | ||||||||||
| echo "------- koa hello -------" | ||||||||||
| echo "" | ||||||||||
| print_head "koa" "koa hello" | ||||||||||
| wrk 'http://127.0.0.1:7002/' \ | ||||||||||
| -d 30 \ | ||||||||||
| -d 10 \ | ||||||||||
| -c 50 \ | ||||||||||
| -t 8 \ | ||||||||||
| -t 4 \ | ||||||||||
| --latency \ | ||||||||||
| -s $REPORT | ||||||||||
|
|
||||||||||
|
|
@@ -93,9 +120,9 @@ echo "------- egg1 hello -------" | |||||||||
| echo "" | ||||||||||
| print_head "egg1" "egg1 hello" | ||||||||||
| wrk 'http://127.0.0.1:7003/' \ | ||||||||||
| -d 30 \ | ||||||||||
| -d 10 \ | ||||||||||
| -c 50 \ | ||||||||||
| -t 8 \ | ||||||||||
| -t 4 \ | ||||||||||
| --latency \ | ||||||||||
| -s $REPORT | ||||||||||
|
|
||||||||||
|
|
@@ -105,9 +132,9 @@ echo "------- egg2 hello -------" | |||||||||
| echo "" | ||||||||||
| print_head "egg2" "egg2 hello" | ||||||||||
| wrk 'http://127.0.0.1:7004/' \ | ||||||||||
| -d 30 \ | ||||||||||
| -d 10 \ | ||||||||||
| -c 50 \ | ||||||||||
| -t 8 \ | ||||||||||
| -t 4 \ | ||||||||||
| --latency \ | ||||||||||
| -s $REPORT | ||||||||||
|
|
||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file is missing a newline character at the end. It's a common convention to end files with a newline to avoid issues with file concatenation and some command-line tools.