File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,21 @@ class Sender extends CoreClient {
102
102
}
103
103
}
104
104
105
+ /**
106
+ * @method _getTotalSent
107
+ * @private
108
+ * @description total messages sent excluding released ones (when not using best effort)
109
+ * @memberof Sender
110
+ */
111
+ _getTotalSent ( ) {
112
+ let totalSent = this . sent ;
113
+ // If using best-effort, then simply ignore released messages
114
+ if ( ! this . options . linkAtMostOnce ) {
115
+ totalSent -= this . released ;
116
+ }
117
+ return totalSent ;
118
+ }
119
+
105
120
/**
106
121
* @method _sendMessage
107
122
* @private
@@ -114,12 +129,7 @@ class Sender extends CoreClient {
114
129
this . _nextRequest ( context , this ) ;
115
130
} else {
116
131
let message = undefined ;
117
- let totalSent = this . sent ;
118
- // If using best-effort, then simply ignore released messages
119
- if ( ! this . options . linkAtMostOnce ) {
120
- totalSent -= this . released ;
121
- }
122
- while ( ( this . options . anonymous || ( context . sender && context . sender . sendable ( ) ) ) && totalSent < this . options . count ) {
132
+ while ( ( this . options . anonymous || ( context . sender && context . sender . sendable ( ) ) ) && this . _getTotalSent ( ) < this . options . count ) {
123
133
this . sent ++ ;
124
134
message = this . _createMessage ( this . sent - 1 ) ;
125
135
You can’t perform that action at this time.
0 commit comments