ilios 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d98a43ed2e7d55fc61fa938bf98da7ae866518af91ac38c169bc96b10fedf9db
4
- data.tar.gz: b09d0ed06e5ff7466d99265c20d4cf43a1b2c9e88701a112e7afd48985ea2854
3
+ metadata.gz: bfc0036bce9b2d84aa66c517c58772bc084a8377997953b149c8192e660d836a
4
+ data.tar.gz: be99b813f53b6abe7d1faa86fe7006e34c202d65928c64f41893c68a77cd9275
5
5
  SHA512:
6
- metadata.gz: 276136abb5f4ec998acc5301b2dd069816206c46a1bcc44005587a7454b3661014a31011a814f2f9863dae7eb83fd9c62a31b27fa0769edc5da0632cc0b06d15
7
- data.tar.gz: 938c8bdf76528f5c953c81df64e76fba4230af03a8af14693fa9cb7cb53638d09b37643510eb68263b1014b7d0fa57bdd54031898666f8ce6599485c40ac8e2c
6
+ metadata.gz: 55fe1cc2ea9e157e81f6d52fd54aeb2e5259f5ce3e078f54260abe76423280464752e3591da167c26c1dd783413cda5ae202f884a7df3d0625ee719724b03673
7
+ data.tar.gz: c2315325480d67a765d0f9b8588649b9bfdc8a99fe2489c4013090faf1d9f44f3f3458258d842aab2203b49d9385fb84393b01b113f9e4debdd58a34060b29cf
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)
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.6'
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.6
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-07 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.6
81
81
  rubygems_mfa_required: 'true'
82
82
  post_install_message:
83
83
  rdoc_options: []