rage-iodine 4.2.2 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/ext/iodine/fio.c +22 -6
- data/ext/iodine/fio.h +9 -0
- data/ext/iodine/iodine_defer.c +31 -0
- data/lib/iodine/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbc2e4408070fc50bbcb07fe6953c8fba6d48a11d315990b97248c4e15e193a1
|
4
|
+
data.tar.gz: 72d3c1f392ce350e253f9f1958ab2744c4f41bf073e8ba60fad16e91bf00fae6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1f9365497d81511cd3482d969101b6d4e6ef59fd08b267d93dae3810e80e02274ccb7d2fa088e8a04aee77a44b482628b3931fc4bcde7fe9b8f92df8adbac8e
|
7
|
+
data.tar.gz: 5acf73720db22d797cec78c27f6c6e7c37cd60f93648f265325a9dbc250c58b8e492050b16a8403d5440e1890693d60a24f01c6f3369aeac2414f7ff33522a84
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ Please notice that this change log contains changes for upcoming releases as wel
|
|
6
6
|
|
7
7
|
## Changes:
|
8
8
|
|
9
|
+
#### Change log v.4.3.0 (2025-08-19)
|
10
|
+
|
11
|
+
**Update**: Add the `task_inc!`, `task_dec!`, `stopping?` methods.
|
12
|
+
|
9
13
|
#### Change log v.4.2.2 (2025-08-10)
|
10
14
|
|
11
15
|
**Fix**: Fix `new_websocket` prototype.
|
data/ext/iodine/fio.c
CHANGED
@@ -390,6 +390,8 @@ typedef struct {
|
|
390
390
|
uint32_t connection_count;
|
391
391
|
/* number of currently paused connections */
|
392
392
|
uint32_t async_connection_count;
|
393
|
+
uint32_t background_task_count;
|
394
|
+
uint8_t stop_requested;
|
393
395
|
/* thread list */
|
394
396
|
fio_ls_s thread_ids;
|
395
397
|
/* active workers */
|
@@ -1299,13 +1301,15 @@ static void fio_defer_on_fork(void) {
|
|
1299
1301
|
}
|
1300
1302
|
|
1301
1303
|
void fio_graceful_stop(void) {
|
1302
|
-
|
1303
|
-
|
1304
|
-
if (!fio_data->async_connection_count) {
|
1304
|
+
if (!fio_data->async_connection_count && !fio_data->background_task_count) {
|
1305
1305
|
fio_stop();
|
1306
|
-
} else if (!stop_requested) {
|
1307
|
-
stop_requested = 1;
|
1308
|
-
|
1306
|
+
} else if (!fio_data->stop_requested) {
|
1307
|
+
fio_data->stop_requested = 1;
|
1308
|
+
if (fio_data->async_connection_count) {
|
1309
|
+
FIO_LOG_INFO("(%d) Waiting for up to 15 seconds to allow active requests to finish...", (int)getpid());
|
1310
|
+
} else {
|
1311
|
+
FIO_LOG_INFO("(%d) Waiting for up to 15 seconds to allow active background tasks to finish...", (int)getpid());
|
1312
|
+
}
|
1309
1313
|
fio_run_every(500, 30, (void (*)(void *))fio_graceful_stop, NULL, (void (*)(void *))fio_stop);
|
1310
1314
|
}
|
1311
1315
|
}
|
@@ -4316,6 +4320,18 @@ void fio_state_callback_clear_all(void) {
|
|
4316
4320
|
}
|
4317
4321
|
}
|
4318
4322
|
|
4323
|
+
void fio_register_background_task() {
|
4324
|
+
fio_atomic_add(&fio_data->background_task_count, 1);
|
4325
|
+
}
|
4326
|
+
|
4327
|
+
void fio_deregister_background_task() {
|
4328
|
+
fio_atomic_sub(&fio_data->background_task_count, 1);
|
4329
|
+
}
|
4330
|
+
|
4331
|
+
uint8_t fio_is_stop_requested() {
|
4332
|
+
return fio_data->stop_requested;
|
4333
|
+
}
|
4334
|
+
|
4319
4335
|
/* *****************************************************************************
|
4320
4336
|
IO bound tasks
|
4321
4337
|
***************************************************************************** */
|
data/ext/iodine/fio.h
CHANGED
@@ -1681,6 +1681,15 @@ void fio_state_callback_force(callback_type_e);
|
|
1681
1681
|
/** Clears all the existing callbacks for the event. */
|
1682
1682
|
void fio_state_callback_clear(callback_type_e);
|
1683
1683
|
|
1684
|
+
/** Increments the background tasks counter. */
|
1685
|
+
void fio_register_background_task();
|
1686
|
+
|
1687
|
+
/** Decrements the background tasks counter. */
|
1688
|
+
void fio_deregister_background_task();
|
1689
|
+
|
1690
|
+
/** Checks whether the server is about to shut down. */
|
1691
|
+
uint8_t fio_is_stop_requested();
|
1692
|
+
|
1684
1693
|
/* *****************************************************************************
|
1685
1694
|
Lower Level API - for special circumstances, use with care.
|
1686
1695
|
***************************************************************************** */
|
data/ext/iodine/iodine_defer.c
CHANGED
@@ -207,6 +207,30 @@ static VALUE iodine_defer_run(VALUE self) {
|
|
207
207
|
(void)self;
|
208
208
|
}
|
209
209
|
|
210
|
+
/* Increments the background tasks counter. */
|
211
|
+
static VALUE iodine_register_background_task(VALUE self) {
|
212
|
+
fio_register_background_task();
|
213
|
+
return Qtrue;
|
214
|
+
(void)self;
|
215
|
+
}
|
216
|
+
|
217
|
+
/* Decrements the background tasks counter. */
|
218
|
+
static VALUE iodine_deregister_background_task(VALUE self) {
|
219
|
+
fio_deregister_background_task();
|
220
|
+
return Qtrue;
|
221
|
+
(void)self;
|
222
|
+
}
|
223
|
+
|
224
|
+
/* Checks whether the server is about to shut down. */
|
225
|
+
static VALUE iodine_is_stop_requested(VALUE self) {
|
226
|
+
if (fio_is_stop_requested()) {
|
227
|
+
return Qtrue;
|
228
|
+
} else {
|
229
|
+
return Qfalse;
|
230
|
+
}
|
231
|
+
(void)self;
|
232
|
+
}
|
233
|
+
|
210
234
|
/**
|
211
235
|
Runs the required block after the specified number of milliseconds have passed.
|
212
236
|
Time is counted only once Iodine started running (using {Iodine.start}).
|
@@ -400,6 +424,13 @@ void iodine_defer_initialize(void) {
|
|
400
424
|
-1);
|
401
425
|
rb_define_module_function(IodineModule, "on_state", iodine_on_state, 1);
|
402
426
|
|
427
|
+
rb_define_module_function(IodineModule, "task_inc!", iodine_register_background_task,
|
428
|
+
0);
|
429
|
+
rb_define_module_function(IodineModule, "task_dec!", iodine_deregister_background_task,
|
430
|
+
0);
|
431
|
+
rb_define_module_function(IodineModule, "stopping?", iodine_is_stop_requested,
|
432
|
+
0);
|
433
|
+
|
403
434
|
STATE_PRE_START = rb_intern("pre_start");
|
404
435
|
STATE_BEFORE_FORK = rb_intern("before_fork");
|
405
436
|
STATE_AFTER_FORK = rb_intern("after_fork");
|
data/lib/iodine/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rage-iodine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boaz Segev
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-08-
|
10
|
+
date: 2025-08-19 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rake
|