nats-pure 2.0.0.pre.rc2 → 2.0.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/lib/nats/io/js.rb +38 -10
- data/lib/nats/io/version.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3aa471703cde005a917e60ee79a8bc0abd87ad12d3548a9ebb8fc0c76aeb9ef
|
4
|
+
data.tar.gz: c7f2954dd2b9dbdbb465faa6efd77183a935a0004ee1158ab8adbd03a68e1580
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dc94ad0a6c22fb5b03c5f87c0727d036e97a6efef0c54b395314ccc56e701e7d8d23912eff51e5dca2adfb84f91102b9291e85a574eb3268d18795883983758
|
7
|
+
data.tar.gz: 5ed00644aca202ea00a988d9197bd26fada520761decd055affa572c9979063521f01f0149156e6b14e70c53ca572ded330ed85bdc30eb8452ad480c93730ca5
|
data/lib/nats/io/js.rb
CHANGED
@@ -507,6 +507,8 @@ module NATS
|
|
507
507
|
case msg.header["Status"]
|
508
508
|
when JS::Status::NoMsgs
|
509
509
|
msg = nil
|
510
|
+
when JS::Status::RequestTimeout
|
511
|
+
# Skip
|
510
512
|
else
|
511
513
|
raise JS.from_msg(msg)
|
512
514
|
end
|
@@ -535,7 +537,13 @@ module NATS
|
|
535
537
|
# Should have received at least a message at this point,
|
536
538
|
# if that is not the case then error already.
|
537
539
|
if JS.is_status_msg(msgs.first)
|
538
|
-
|
540
|
+
msg = msgs.first
|
541
|
+
case msg.header[JS::Header::Status]
|
542
|
+
when JS::Status::RequestTimeout
|
543
|
+
raise NATS::Timeout.new("nats: fetch request timeout")
|
544
|
+
else
|
545
|
+
raise JS.from_msg(msgs.first)
|
546
|
+
end
|
539
547
|
end
|
540
548
|
end
|
541
549
|
when batch > 1
|
@@ -546,7 +554,22 @@ module NATS
|
|
546
554
|
# Check if there already enough in the pending buffer.
|
547
555
|
synchronize do
|
548
556
|
if batch <= @pending_queue.size
|
549
|
-
batch.times
|
557
|
+
batch.times do
|
558
|
+
msg = @pending_queue.pop
|
559
|
+
|
560
|
+
# Check for a no msgs response status.
|
561
|
+
if JS.is_status_msg(msg)
|
562
|
+
case msg.header[JS::Header::Status]
|
563
|
+
when JS::Status::NoMsgs, JS::Status::RequestTimeout
|
564
|
+
# Skip these
|
565
|
+
next
|
566
|
+
else
|
567
|
+
raise JS.from_msg(msg)
|
568
|
+
end
|
569
|
+
else
|
570
|
+
msgs << msg
|
571
|
+
end
|
572
|
+
end
|
550
573
|
|
551
574
|
return msgs
|
552
575
|
end
|
@@ -574,11 +597,13 @@ module NATS
|
|
574
597
|
next_req.delete(:no_wait)
|
575
598
|
|
576
599
|
@nc.publish(@jsi.nms, JS.next_req_to_json(next_req), @subject)
|
600
|
+
when JS::Status::RequestTimeout
|
601
|
+
raise NATS::Timeout.new("nats: fetch request timeout")
|
577
602
|
else
|
578
603
|
raise JS.from_msg(msg)
|
579
604
|
end
|
580
605
|
else
|
581
|
-
msgs << msg
|
606
|
+
msgs << msg unless msg.nil?
|
582
607
|
end
|
583
608
|
|
584
609
|
# Check if have not received yet a single message.
|
@@ -607,21 +632,24 @@ module NATS
|
|
607
632
|
msg = @pending_queue.pop
|
608
633
|
|
609
634
|
if JS.is_status_msg(msg)
|
610
|
-
case msg.header[
|
635
|
+
case msg.header[JS::Header::Status]
|
611
636
|
when JS::Status::NoMsgs, JS::Status::RequestTimeout
|
612
637
|
duration = MonotonicTime.since(start_time)
|
613
638
|
|
614
|
-
|
615
|
-
|
616
|
-
|
639
|
+
if duration > timeout
|
640
|
+
# Only received a subset of the messages.
|
641
|
+
if !msgs.empty?
|
642
|
+
return msgs
|
643
|
+
else
|
644
|
+
raise NATS::Timeout.new("nats: fetch timeout")
|
645
|
+
end
|
617
646
|
end
|
618
|
-
|
619
|
-
# Likely only received a subset of the messages.
|
620
|
-
return msgs
|
621
647
|
else
|
622
648
|
raise JS.from_msg(msg)
|
623
649
|
end
|
650
|
+
|
624
651
|
else
|
652
|
+
# Add to the set of messages that will be returned.
|
625
653
|
msgs << msg
|
626
654
|
needed -= 1
|
627
655
|
end
|
data/lib/nats/io/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2016-
|
1
|
+
# Copyright 2016-2022 The NATS Authors
|
2
2
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
3
|
# you may not use this file except in compliance with the License.
|
4
4
|
# You may obtain a copy of the License at
|
@@ -15,7 +15,7 @@
|
|
15
15
|
module NATS
|
16
16
|
module IO
|
17
17
|
# VERSION is the version of the client announced on CONNECT to the server.
|
18
|
-
VERSION = "2.0.0
|
18
|
+
VERSION = "2.0.0".freeze
|
19
19
|
|
20
20
|
# LANG is the lang runtime of the client announced on CONNECT to the server.
|
21
21
|
LANG = "#{RUBY_ENGINE}#{RUBY_VERSION}".freeze
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nats-pure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Waldemar Quevedo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: NATS is an open-source, high-performance, lightweight cloud messaging
|
14
14
|
system.
|
@@ -44,9 +44,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
44
|
version: '0'
|
45
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - "
|
47
|
+
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
49
|
+
version: '0'
|
50
50
|
requirements: []
|
51
51
|
rubygems_version: 3.2.22
|
52
52
|
signing_key:
|