wsky / top-push

Message-push abstraction component, provide useful messaging components.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

flush never stop while sendMessage error

wsky opened this issue · comments

send error and return

try {
                // here maybe have many exception, use statusCode instead
                if (!connection.sendMessage(message))
                    return;
            } catch (Exception e) {
                onDrop(message, "send message error");
                this.logger.error("send message error", e);
                return; // only send once
            } finally {
                connectionQueue.add(connection);
            }

but flush not stop

for (int i = 0; i < count; i++) {
            if (token.isCancelling())
                break;
            Object msg = this.pendingMessages.poll();
            if (msg == null)
                break;
            this.SendMessage(token, msg);
            temp++;
        }

flush logic should like this, send message to connections until success or not any connection, flush until sendMessage error