ilios 0.4.5 → 0.4.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d98a43ed2e7d55fc61fa938bf98da7ae866518af91ac38c169bc96b10fedf9db
4
- data.tar.gz: b09d0ed06e5ff7466d99265c20d4cf43a1b2c9e88701a112e7afd48985ea2854
3
+ metadata.gz: 7794c439a6a3b6c6f0362b2b1d4b20b553727473320921d6c370a524e6863c39
4
+ data.tar.gz: 8d01681e24c7b822f3a4e96837f4682cbb139527c1660a1d2db7371ff9cba551
5
5
  SHA512:
6
- metadata.gz: 276136abb5f4ec998acc5301b2dd069816206c46a1bcc44005587a7454b3661014a31011a814f2f9863dae7eb83fd9c62a31b27fa0769edc5da0632cc0b06d15
7
- data.tar.gz: 938c8bdf76528f5c953c81df64e76fba4230af03a8af14693fa9cb7cb53638d09b37643510eb68263b1014b7d0fa57bdd54031898666f8ce6599485c40ac8e2c
6
+ metadata.gz: 7b2e96c2adcf02b602ba9e97d2ba25bbecd3816106519ab3b61e97f814df033f01650bbd2a99fc9b7475f26e2cc598c6a864b1098215a9742be65ee80a3695ad
7
+ data.tar.gz: 3d5ca806b3f682fe2427e3f3cd091ceacd8a98e5894479ddf6bd5cbcb721f58ca4e64cb4a2e3e318b7aff36ed09a851791d04403cc185d4f03adbefeb045c385
data/ext/ilios/cluster.c CHANGED
@@ -135,35 +135,35 @@ static VALUE cluster_keyspace(VALUE self, VALUE keyspace)
135
135
  }
136
136
 
137
137
  /**
138
- * Sets the timeout for connecting to a node.
139
- * Default is +5000+ milliseconds.
138
+ * Sets the protocol version. The driver will automatically downgrade to the lowest supported protocol version.
139
+ * Default is +PROTOCOL_VERSION_V4+.
140
140
  *
141
141
  * @param timeout_ms [Integer] A connect timeout in milliseconds.
142
142
  * @return [Cassandra::Cluster] self.
143
143
  */
144
- static VALUE cluster_connect_timeout(VALUE self, VALUE timeout_ms)
144
+ static VALUE cluster_protocol_version(VALUE self, VALUE version)
145
145
  {
146
146
  CassandraCluster *cassandra_cluster;
147
147
 
148
148
  GET_CLUSTER(self, cassandra_cluster);
149
- cass_cluster_set_connect_timeout(cassandra_cluster->cluster, NUM2UINT(timeout_ms));
149
+ cass_cluster_set_protocol_version(cassandra_cluster->cluster, NUM2INT(version));
150
150
 
151
151
  return self;
152
152
  }
153
153
 
154
154
  /**
155
- * Sets the protocol version. The driver will automatically downgrade to the lowest supported protocol version.
156
- * Default is +PROTOCOL_VERSION_V4+.
155
+ * Sets the timeout for connecting to a node.
156
+ * Default is +5000+ milliseconds.
157
157
  *
158
158
  * @param timeout_ms [Integer] A connect timeout in milliseconds.
159
159
  * @return [Cassandra::Cluster] self.
160
160
  */
161
- static VALUE cluster_protocol_version(VALUE self, VALUE version)
161
+ static VALUE cluster_connect_timeout(VALUE self, VALUE timeout_ms)
162
162
  {
163
163
  CassandraCluster *cassandra_cluster;
164
164
 
165
165
  GET_CLUSTER(self, cassandra_cluster);
166
- cass_cluster_set_protocol_version(cassandra_cluster->cluster, NUM2INT(version));
166
+ cass_cluster_set_connect_timeout(cassandra_cluster->cluster, NUM2UINT(timeout_ms));
167
167
 
168
168
  return self;
169
169
  }
data/ext/ilios/future.c CHANGED
@@ -33,10 +33,23 @@ static void future_thread_pool_init(future_thread_pool *pool)
33
33
  {
34
34
  pool->queue = rb_funcall(cQueue, id_new, 0);
35
35
  rb_gc_register_mark_object(pool->queue);
36
+ }
37
+
38
+ static void future_thread_pool_prepare_thread(future_thread_pool *pool)
39
+ {
40
+ VALUE status;
36
41
 
37
42
  for (int i = 0; i < THREAD_MAX; i++) {
38
- pool->thread[i] = rb_thread_create(future_result_yielder_thread, (void*)pool);
39
- rb_gc_register_mark_object(pool->thread[i]);
43
+ status = Qfalse;
44
+
45
+ if (pool->thread[i]) {
46
+ status = rb_funcall(pool->thread[i], id_alive, 0);
47
+ }
48
+ if (!pool->thread[i] || !RTEST(status)) {
49
+ pool->thread[i] = rb_thread_create(future_result_yielder_thread, (void*)pool);
50
+ rb_funcall(pool->thread[i], id_report_on_exception, 1, Qtrue);
51
+ rb_gc_register_address(&pool->thread[i]);
52
+ }
40
53
  }
41
54
  }
42
55
 
@@ -58,6 +71,7 @@ static inline future_thread_pool *future_thread_pool_get(CassandraFuture *cassan
58
71
  static inline void future_queue_push(future_thread_pool *pool, VALUE future)
59
72
  {
60
73
  rb_funcall(pool->queue, id_push, 1, future);
74
+ future_thread_pool_prepare_thread(pool);
61
75
  }
62
76
 
63
77
  static inline VALUE future_queue_pop(future_thread_pool *pool)
@@ -137,7 +151,6 @@ static VALUE future_result_yielder_body(VALUE future)
137
151
 
138
152
  nogvl_future_wait(cassandra_future->future);
139
153
  return rb_mutex_synchronize(cassandra_future->proc_mutex, future_result_yielder_synchronize, future);
140
-
141
154
  }
142
155
 
143
156
  static VALUE future_result_yielder_ensure(VALUE future)
@@ -290,7 +303,7 @@ static VALUE future_await(VALUE self)
290
303
  GET_FUTURE(self, cassandra_future);
291
304
 
292
305
  if (cassandra_future->already_waited) {
293
- rb_raise(eExecutionError, "It should not call twice");
306
+ return self;
294
307
  }
295
308
 
296
309
  if (cassandra_future->on_success_block || cassandra_future->on_failure_block) {
data/ext/ilios/ilios.c CHANGED
@@ -17,6 +17,8 @@ VALUE id_to_time;
17
17
  VALUE id_new;
18
18
  VALUE id_push;
19
19
  VALUE id_pop;
20
+ VALUE id_alive;
21
+ VALUE id_report_on_exception;
20
22
  VALUE sym_unsupported_column_type;
21
23
 
22
24
  #if defined(HAVE_MALLOC_USABLE_SIZE)
@@ -77,6 +79,8 @@ void Init_ilios(void)
77
79
  id_new = rb_intern("new");
78
80
  id_push = rb_intern("push");
79
81
  id_pop = rb_intern("pop");
82
+ id_alive = rb_intern("alive?");
83
+ id_report_on_exception = rb_intern("report_on_exception=");
80
84
  sym_unsupported_column_type = ID2SYM(rb_intern("unsupported_column_type"));
81
85
 
82
86
  Init_cluster();
data/ext/ilios/ilios.h CHANGED
@@ -91,6 +91,8 @@ extern VALUE id_to_time;
91
91
  extern VALUE id_new;
92
92
  extern VALUE id_push;
93
93
  extern VALUE id_pop;
94
+ extern VALUE id_alive;
95
+ extern VALUE id_report_on_exception;
94
96
  extern VALUE sym_unsupported_column_type;
95
97
 
96
98
  extern void Init_cluster(void);
data/lib/ilios/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ilios
4
- VERSION = '0.4.5'
4
+ VERSION = '0.4.7'
5
5
  public_constant :VERSION
6
6
 
7
7
  CASSANDRA_CPP_DRIVER_VERSION = '2.17.1'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ilios
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Watson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-06 00:00:00.000000000 Z
11
+ date: 2024-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mini_portile2
@@ -77,7 +77,7 @@ metadata:
77
77
  homepage_uri: https://github.com/Watson1978/ilios
78
78
  source_code_uri: https://github.com/Watson1978/ilios
79
79
  bug_tracker_uri: https://github.com/Watson1978/ilios/issues
80
- documentation_uri: https://www.rubydoc.info/gems/ilios/0.4.5
80
+ documentation_uri: https://www.rubydoc.info/gems/ilios/0.4.7
81
81
  rubygems_mfa_required: 'true'
82
82
  post_install_message:
83
83
  rdoc_options: []