Skip to content
This repository has been archived by the owner on Jun 8, 2020. It is now read-only.

#502 kraken resubscribe issue #551

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

pchertalev
Copy link
Contributor

@pchertalev pchertalev commented Mar 12, 2020

#502 issue fix
Batch resubscribing has been implemented

@pchertalev
Copy link
Contributor Author

@badgerwithagun

@@ -27,6 +20,14 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.math.BigDecimal;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you run a maven build so the coveo-fmt plugin runs?

We've introduced that to avoid formatting issues like these creeping into PRs.

Thanks!

private ObjectMapper mapper = StreamingObjectMapperHelper.getObjectMapper();
private final boolean isPrivate;

private final Map<Integer, String> subscriptionRequestMap = new ConcurrentHashMap<>();
private final Map<Integer, Set<String>> subscriptionRequestMap = new ConcurrentHashMap<>();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may find guava synchronized multimaps deal with this better and more thread-safely (not convinced that the remove() is being used in a thread-safe way).

+ KRAKEN_CHANNEL_DELIMITER
+ currencyPair;
channelsList.remove(channelName);
if (channelsList.isEmpty()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the bit I'm not convinced is thread-safe.

subscriptionName + (depth == null ? "" : (KRAKEN_CHANNEL_DELIMITER + depth)),
d ->
new KrakenSubscriptionMessage(
Math.abs(UUID.randomUUID().hashCode()),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will probably collide quite often. Maybe safer to use a static AtomicLong? Does it need to be unique?

HashMap<String, KrakenSubscriptionMessage> messages = new HashMap<>();
for (Map.Entry<String, Subscription> entry : super.channels.entrySet()) {

String[] channelData = entry.getKey().split(KRAKEN_CHANNEL_DELIMITER);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this would be easier to read if maybe you created a KrakenSubscription object and added a decode method, e.g.

private KrakenSubscription decodeSubscription(Subscription subscription) {}

@badgerwithagun badgerwithagun added the awaiting_fixes PR is awaiting submitter to respond to a review label Mar 14, 2020
@badgerwithagun
Copy link
Collaborator

This project is in the process of being merged into the XChange project and no further PRs will be merged here. Once the projects have been merged, there may be a short stabilization period where there will be large-scale renaming of classes and packages, which may cause conflicts. You are advised to wait at least a week from now and then resubmit your PR on the XChange project. Thank you for your support!

@badgerwithagun
Copy link
Collaborator

You can now resubmit your PR on XChange. This project will shortly be marked as archived.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
awaiting_fixes PR is awaiting submitter to respond to a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants