Skip to content

Commit c09f139

Browse files
committed
Release v2.0.0
1 parent eb523ff commit c09f139

3 files changed

Lines changed: 41 additions & 29 deletions

File tree

‎bootstrap.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ for dir in $(find unicode-* -maxdepth 0 -type d | sort -r); do
1111
cd "${dir}";
1212
echo "Taking care of ${dir}…";
1313
git add -A;
14-
git commit -m 'Release v1.6.17';
15-
git tag v1.6.17;
14+
git commit -m 'Release v2.0.0';
15+
git tag v2.0.0;
1616
git push;
1717
git push --tags;
1818
cd ..;

‎scripts/generate-data.mjs‎

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,50 +38,62 @@ const complicatedWorkThatTakesTime = async (resource, callback) => {
3838
};
3939

4040
if (cluster.isPrimary) {
41+
const chunks = Array.from({ length: numCPUs }, () => []);
42+
resources.forEach((resource, index) => {
43+
chunks[index % numCPUs].push(resource);
44+
});
45+
4146
for (let index = 0; index < numCPUs; index++) {
4247
const worker = cluster.fork();
43-
worker.on('message', (error) => {
44-
for (const id in cluster.workers) {
45-
cluster.workers[id].kill();
48+
worker.on('message', (message) => {
49+
if (message?.type === 'ready') {
50+
const workerIndex = worker.id - 1;
51+
worker.send({
52+
type: 'work',
53+
resources: chunks[workerIndex] || [],
54+
});
55+
} else if (message?.type === 'error') {
56+
for (const id in cluster.workers) {
57+
cluster.workers[id].kill();
58+
}
59+
throw new Error(`Worker ${worker.id} encountered an error: ${message.message}`);
4660
}
47-
throw new Error(`Worker ${worker.id} encountered an error: ${error}`);
4861
});
4962
}
5063

51-
cluster.on('online', (worker) => {
52-
const size = Math.round(resources.length / numCPUs);
53-
const x = worker.id - 1;
54-
55-
// Divide work.
56-
if (worker.id === 1) { // First worker.
57-
worker.send(resources.slice(0, worker.id * size));
58-
} else if (worker.id < numCPUs) { // Other workers, except the last one.
59-
worker.send(resources.slice(x * size, worker.id * size));
60-
} else { // Last worker.
61-
worker.send(resources.slice(x * size, resources.length));
62-
}
63-
});
64-
6564
cluster.on('exit', (worker) => {
6665
if (worker.exitedAfterDisconnect) {
6766
console.log('[%s] Worker %d is done!', getTime(), worker.id);
6867
}
6968
});
7069
} else {
7170
process.on('message', (message) => {
72-
complicatedWorkThatTakesTime(message, () => {
73-
cluster.worker.kill();
74-
});
71+
if (message?.type === 'work') {
72+
complicatedWorkThatTakesTime(message.resources, () => {
73+
cluster.worker.kill();
74+
});
75+
}
7576
});
7677

7778
process.on('uncaughtException', (error) => {
7879
console.error(error);
79-
process.send(error.message);
80+
process.send({
81+
type: 'error',
82+
message: error.message,
83+
});
8084
});
8185

8286
process.on('unhandledRejection', (error) => {
8387
console.error(error);
84-
process.send(error.message || error);
88+
process.send({
89+
type: 'error',
90+
message: error.message || error,
91+
});
92+
});
93+
94+
process.send({
95+
type: 'ready',
8596
});
8697
}
8798

99+

‎static/.github/workflows/publish-on-tag.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
contents: read
1313
id-token: write
1414
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v4
15+
- name: Check out repository
16+
uses: actions/checkout@v7
1717
- name: Set up Node.js
18-
uses: actions/setup-node@v4
18+
uses: actions/setup-node@v7
1919
with:
20-
node-version: 20
20+
node-version: 26
2121
registry-url: 'https://registry.npmjs.org'
2222
- name: Update npm
2323
run: npm install -g npm@latest

0 commit comments

Comments
 (0)