itsi-server 0.2.7 → 0.2.8
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/Cargo.lock +1 -1
- data/ext/itsi_scheduler/Cargo.toml +1 -1
- data/ext/itsi_scheduler/src/itsi_scheduler.rs +16 -10
- data/ext/itsi_server/Cargo.toml +1 -1
- data/lib/itsi/server/config/config_helpers.rb +9 -0
- data/lib/itsi/server/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af4b4507b2a8f479ed8ff4c624f37caacfe7f3315c9d91aa701f2695132890dc
|
4
|
+
data.tar.gz: 481f479beddf0fd8d8f5e0efa456de5ec85412432f6bf118fc5a7ab3d37818b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a834041382f80fe187ecf2b1bd7ff06ea019d38de25f385f59d0a2f5c0fb0a86136e091a4d83963535410690c1aa742f384ea54e615cf02d17a6a74103bef75
|
7
|
+
data.tar.gz: ebcd44edf2e628851ae9a6d67734a04b5cdd32f2cc689646eb52db07433ab030a38163915ce4fdbbac68ac7196c452ac237752521b61aa729881a85b93d5d2f9
|
data/Cargo.lock
CHANGED
@@ -7,7 +7,7 @@ use itsi_error::ItsiError;
|
|
7
7
|
use itsi_rb_helpers::{call_without_gvl, create_ruby_thread};
|
8
8
|
use magnus::{
|
9
9
|
error::Result as MagnusResult,
|
10
|
-
value::{InnerValue, Opaque, ReprValue},
|
10
|
+
value::{InnerValue, Lazy, LazyId, Opaque, ReprValue},
|
11
11
|
Module, RClass, Ruby, Value,
|
12
12
|
};
|
13
13
|
use mio::{Events, Poll, Token, Waker};
|
@@ -19,7 +19,7 @@ use std::{
|
|
19
19
|
time::Duration,
|
20
20
|
};
|
21
21
|
use timer::Timer;
|
22
|
-
use tracing::{debug, info, warn};
|
22
|
+
use tracing::{debug, error, info, warn};
|
23
23
|
|
24
24
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
25
25
|
pub(crate) struct Readiness(i16);
|
@@ -31,6 +31,9 @@ impl std::fmt::Debug for ItsiScheduler {
|
|
31
31
|
}
|
32
32
|
|
33
33
|
const WAKE_TOKEN: Token = Token(0);
|
34
|
+
static ID_CURRENT: LazyId = LazyId::new("current");
|
35
|
+
static CLASS_FIBER: Lazy<RClass> =
|
36
|
+
Lazy::new(|ruby| ruby.module_kernel().const_get("Fiber").unwrap());
|
34
37
|
|
35
38
|
#[magnus::wrap(class = "Itsi::Scheduler", free_immediately, size)]
|
36
39
|
pub(crate) struct ItsiScheduler {
|
@@ -225,14 +228,17 @@ impl ItsiScheduler {
|
|
225
228
|
let result: Arc<RwLock<Option<T>>> = Arc::new(RwLock::new(None));
|
226
229
|
let result_clone = Arc::clone(&result);
|
227
230
|
|
228
|
-
let
|
229
|
-
let
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
231
|
+
let class_fiber = ruby.get_inner(&CLASS_FIBER);
|
232
|
+
let current_fiber = ruby
|
233
|
+
.get_inner(&CLASS_FIBER)
|
234
|
+
.funcall::<_, _, Value>(*ID_CURRENT, ());
|
235
|
+
|
236
|
+
if current_fiber.is_err() {
|
237
|
+
error!("Failed to get current fiber");
|
238
|
+
return Err(ItsiError::ArgumentError("Failed to get current fiber".to_string()).into());
|
239
|
+
}
|
240
|
+
let current_fiber = Opaque::from(current_fiber.unwrap());
|
241
|
+
let scheduler = Opaque::from(class_fiber.funcall::<_, _, Value>("scheduler", ()).unwrap());
|
236
242
|
|
237
243
|
create_ruby_thread(move || {
|
238
244
|
call_without_gvl(|| {
|
data/ext/itsi_server/Cargo.toml
CHANGED
@@ -42,7 +42,16 @@ module Itsi
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def self.included(cls) # rubocop:disable Metrics/PerceivedComplexity,Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
|
45
|
+
|
46
|
+
class << cls
|
47
|
+
def subclasses
|
48
|
+
@subclasses ||= []
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
45
52
|
def cls.inherited(base) # rubocop:disable Metrics/MethodLength,Lint/MissingSuper,Metrics/PerceivedComplexity
|
53
|
+
self.subclasses << base
|
54
|
+
|
46
55
|
%i[detail documentation insert_text schema].each do |attr|
|
47
56
|
base.define_singleton_method(attr) do |value = nil|
|
48
57
|
@middleware_class_attrs ||= {}
|
data/lib/itsi/server/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itsi-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wouter Coppieters
|
@@ -51,6 +51,20 @@ dependencies:
|
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 0.9.91
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: prism
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.4'
|
61
|
+
type: :runtime
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '1.4'
|
54
68
|
- !ruby/object:Gem::Dependency
|
55
69
|
name: ruby-lsp
|
56
70
|
requirement: !ruby/object:Gem::Requirement
|