-
-
Notifications
You must be signed in to change notification settings - Fork 807
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
100 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
singleQuote: true | ||
arrowParens: avoid | ||
arrowParens: "avoid" | ||
semi: false | ||
overrides: | ||
- files: '*.md' | ||
- files: "*.md" | ||
options: | ||
printWidth: 9999 | ||
proseWrap: never | ||
proseWrap: "never" |
6 changes: 1 addition & 5 deletions
6
.sqlx/query-3a5b2a81088aa91ade3106165f926c337a88f4e29ae3bb170c4b687208aba20d.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
jQuery(document).ready(function () { | ||
let rotation = 0; | ||
jQuery("img").click(function () { | ||
rotation += 360; | ||
jQuery("img").css({'transform': 'rotate(' + rotation + 'deg)'}); | ||
}); | ||
}); | ||
let rotation = 0 | ||
jQuery("img").click(function () { | ||
rotation += 360 | ||
jQuery("img").css({ transform: "rotate(" + rotation + "deg)" }) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// import './assets/main.css' | ||
|
||
import { createApp } from 'vue' | ||
import App from './App.vue' | ||
import { createApp } from "vue" | ||
import App from "./App.vue" | ||
|
||
createApp(App).mount('#app') | ||
createApp(App).mount("#app") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
import { fileURLToPath, URL } from 'node:url' | ||
import { fileURLToPath, URL } from "node:url" | ||
|
||
import { defineConfig } from 'vite' | ||
import vue from '@vitejs/plugin-vue' | ||
import { defineConfig } from "vite" | ||
import vue from "@vitejs/plugin-vue" | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [ | ||
vue(), | ||
], | ||
plugins: [vue()], | ||
resolve: { | ||
alias: { | ||
'@': fileURLToPath(new URL('./src', import.meta.url)) | ||
} | ||
} | ||
"@": fileURLToPath(new URL("./src", import.meta.url)), | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
_list: | ||
@just --list | ||
|
||
# Format project. | ||
[group("lint")] | ||
fmt: | ||
cargo +nightly fmt | ||
fd --type=file --hidden --extension=yml --extension=md --extension=js --exec-batch npx -y prettier --write | ||
|
||
# Run Clippy over workspace. | ||
[group("lint")] | ||
clippy: | ||
cargo clippy --workspace --all-targets --all-features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,73 @@ | ||
const http = require('http') | ||
const http = require("http") | ||
|
||
const n = 120 | ||
let connected = 0 | ||
let messages = 0 | ||
let start = Date.now() | ||
let phase = 'connecting' | ||
let phase = "connecting" | ||
let connection_time | ||
let broadcast_time | ||
|
||
let message = process.argv[2] || 'msg' | ||
let expected_data = 'data: ' + message | ||
let message = process.argv[2] || "msg" | ||
let expected_data = "data: " + message | ||
|
||
for (let i = 0; i < n; i++) { | ||
http | ||
.get( | ||
{ | ||
host: '127.0.0.1', | ||
host: "127.0.0.1", | ||
port: 8080, | ||
path: '/events', | ||
path: "/events", | ||
}, | ||
(response) => { | ||
response.on('data', (data) => { | ||
response => { | ||
response.on("data", data => { | ||
if (data.includes(expected_data)) { | ||
messages += 1 | ||
} else if (data.includes('data: connected\n')) { | ||
} else if (data.includes("data: connected\n")) { | ||
connected += 1 | ||
} | ||
}) | ||
} | ||
}, | ||
) | ||
.on('error', (_) => {}) | ||
.on("error", _ => {}) | ||
} | ||
|
||
setInterval(() => { | ||
if (phase === 'connecting' && connected === n) { | ||
if (phase === "connecting" && connected === n) { | ||
// done connecting | ||
phase = 'messaging' | ||
phase = "messaging" | ||
connection_time = Date.now() - start | ||
} | ||
|
||
if (phase === 'messaging') { | ||
phase = 'waiting' | ||
if (phase === "messaging") { | ||
phase = "waiting" | ||
start = Date.now() | ||
|
||
http | ||
.request( | ||
{ | ||
method: 'POST', | ||
host: '127.0.0.1', | ||
method: "POST", | ||
host: "127.0.0.1", | ||
port: 8080, | ||
path: '/broadcast/' + message, | ||
path: "/broadcast/" + message, | ||
}, | ||
response => { | ||
response.on("data", _ => {}) | ||
}, | ||
(response) => { | ||
response.on('data', (_) => {}) | ||
} | ||
) | ||
.end() | ||
} | ||
|
||
if (phase === 'waiting' && messages >= n) { | ||
if (phase === "waiting" && messages >= n) { | ||
// all messages received | ||
broadcast_time = Date.now() - start | ||
phase = 'paused' | ||
phase = "paused" | ||
messages = 0 | ||
phase = 'messaging' | ||
phase = "messaging" | ||
} | ||
|
||
process.stdout.write('\r\x1b[K') | ||
process.stdout.write("\r\x1b[K") | ||
process.stdout.write( | ||
`Connected: ${connected}, connection time: ${connection_time} ms, total broadcast time: ${broadcast_time} ms` | ||
`Connected: ${connected}, connection time: ${connection_time} ms, total broadcast time: ${broadcast_time} ms`, | ||
) | ||
}, 20) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,42 @@ | ||
const http = require('http') | ||
const http = require("http") | ||
|
||
let drop_goal = 5_000 | ||
let dropped = 0 | ||
|
||
let query = { | ||
method: 'POST', | ||
host: '127.0.0.1', | ||
method: "POST", | ||
host: "127.0.0.1", | ||
port: 8080, | ||
path: '/events', | ||
path: "/events", | ||
} | ||
|
||
setInterval(() => { | ||
if (dropped < drop_goal) { | ||
let request = http | ||
.request(query, (response) => { | ||
response.on('data', (data) => { | ||
if (data.includes('data: connected\n')) { | ||
.request(query, response => { | ||
response.on("data", data => { | ||
if (data.includes("data: connected\n")) { | ||
// drop connection after welcome message | ||
dropped += 1 | ||
request.abort() | ||
} | ||
}) | ||
}) | ||
.on('error', () => {}) | ||
.on("error", () => {}) | ||
.end() | ||
} | ||
}, 0) | ||
|
||
setInterval(() => { | ||
http.request({ ...query, path: '/' }, () => print_status(true)) | ||
http | ||
.request({ ...query, path: "/" }, () => print_status(true)) | ||
.setTimeout(100, () => print_status(false)) | ||
.on('error', () => {}) | ||
.on("error", () => {}) | ||
}, 20) | ||
|
||
function print_status(accepting_connections) { | ||
process.stdout.write('\r\x1b[K') | ||
process.stdout.write("\r\x1b[K") | ||
process.stdout.write( | ||
`Connections dropped: ${dropped}, accepting connections: ${accepting_connections}` | ||
`Connections dropped: ${dropped}, accepting connections: ${accepting_connections}`, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters