MCPcopy Create free account
hub / github.com/SOHU-Co/kafka-node / commit

Method commit

lib/commitStream.js:125–152  ·  view source on GitHub ↗
(cb)

Source from the content-addressed store, hash-verified

123 }
124
125 commit (cb) {
126 let self = this;
127
128 if (!cb) {
129 cb = function noop () {};
130 }
131
132 if (self.committing) {
133 return cb(null, 'Commit in progress');
134 }
135
136 let topicPartionOffsets = self.topicPartionOffsets;
137
138 let commits = topicPartionOffsets.filter(function (partition) {
139 return partition.offset !== 0;
140 });
141
142 if (commits.length) {
143 self.committing = true;
144 self.client.sendOffsetCommitRequest(self.groupId, commits, function () {
145 self.emit('commitComplete', { group: self.groupId, commits });
146 self.committing = false;
147 cb.apply(this, arguments);
148 });
149 } else {
150 cb(null, 'Nothing to be committed');
151 }
152 }
153}
154
155module.exports = CommitStream;

Callers 12

constructorMethod · 0.95
offset.jsFile · 0.45
consumerStream.jsFile · 0.45
offset.jsFile · 0.45
consumerGroup.jsFile · 0.45
_transformMethod · 0.45
consumer.jsFile · 0.45
test.consumer.jsFile · 0.45
test.offset.jsFile · 0.45

Calls 1

emitMethod · 0.80

Tested by

no test coverage detected