File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,13 +21,13 @@ RUN mkdir -p /home/node/contracts/source
2121RUN chown node:node /home/node/contracts/source
2222WORKDIR /home/node/contracts/source
2323USER node
24- COPY --from=solidity-build /home/node/contracts /home/node/package*.json ./
24+ COPY --from=solidity-build --chown=node:node /home/node/contracts /home/node/package*.json ./
2525RUN npm install --production
2626WORKDIR /home/node/contracts
27- COPY --from=solidity-build /home/node/artifacts/contracts/TokenFactory.sol/TokenFactory.json ./
27+ COPY --from=solidity-build --chown=node:node /home/node/artifacts/contracts/TokenFactory.sol/TokenFactory.json ./
2828WORKDIR /home/node
29- COPY --from=build /home/node/dist ./dist
30- COPY --from=build /home/node/package.json /home/node/package-lock.json ./
29+ COPY --from=build --chown=node:node /home/node/dist ./dist
30+ COPY --from=build --chown=node:node /home/node/package.json /home/node/package-lock.json ./
3131
3232
3333RUN npm install --production
Original file line number Diff line number Diff line change @@ -190,12 +190,21 @@ export abstract class EventStreamProxyBase extends WebSocketEventsBase {
190190 return ;
191191 }
192192
193- this . logger . log ( `Received ack ${ data . id } ` ) ;
194- if ( this . socket !== undefined && this . awaitingAck . find ( msg => msg . id === data . id ) ) {
195- const firstAck = this . awaitingAck . find ( msg => msg . id === data . id ) ;
193+ const inflight = this . awaitingAck . find ( msg => msg . id === data . id )
194+ this . logger . log ( `Received ack ${ data . id } inflight= ${ ! ! inflight } ` ) ;
195+ if ( this . socket !== undefined && inflight !== undefined ) {
196196 this . awaitingAck = this . awaitingAck . filter ( msg => msg . id !== data . id ) ;
197- if ( firstAck ) {
198- this . socket . ack ( firstAck . batchNumber ) ;
197+ if (
198+ // If nothing is left awaiting an ack - then we clearly need to ack
199+ this . awaitingAck . length === 0 ||
200+ (
201+ // Or if we have a batch number associated with this ID, then we can only ack if there
202+ // are no other messages in-flight with the same batch number.
203+ inflight . batchNumber !== undefined && ! this . awaitingAck . find ( msg => msg . batchNumber === inflight . batchNumber )
204+ )
205+ ) {
206+ this . logger . log ( `In-flight batch complete (batchNumber=${ inflight . batchNumber } )` ) ;
207+ this . socket . ack ( inflight . batchNumber ) ;
199208 }
200209 }
201210 }
You can’t perform that action at this time.
0 commit comments