Skip to content

Conversation

@peiyush13
Copy link
Collaborator

@peiyush13 peiyush13 added the enhancement New feature or request label Jul 5, 2018
@maanavshah maanavshah force-pushed the reconnection_support branch from b52baee to 446500a Compare July 6, 2018 11:18
@peiyush13 peiyush13 force-pushed the reconnection_support branch 2 times, most recently from b52baee to 446500a Compare July 6, 2018 11:39
@maanavshah maanavshah force-pushed the reconnection_support branch 2 times, most recently from e82357c to 8018096 Compare July 6, 2018 13:03
@peiyush13 peiyush13 force-pushed the reconnection_support branch from 8018096 to 0022ddb Compare July 6, 2018 13:07
Added reconnection strategy for socketclusterclient
@peiyush13 peiyush13 force-pushed the reconnection_support branch from 0022ddb to 5ba021d Compare July 6, 2018 13:17
include DataModels
include Reconnect

attr_accessor :reconnect_interval, :max_reconnect_interval, :reconnect_decay, :max_attempts, :attempts_made
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't need to add attr_accessor for variables used in the class itself and unless we are using strong params.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  • attr_accessors are used here to avoid unnecessary for getter-setter methods, strong params are not applicable here

README.md Outdated
```

- For disabling reconnection to server
- To disable Automatic Reconnection
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please change it to: To disable automatic reconnection to server

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

def reconnection_attempts_finished
return @attempts_made == @max_attempts
end

Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove this line, or else run rubocop --autocorrect which will fix this issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

#
#
def set_reconnection_listener(reconnect_interval, max_reconnect_interval, reconnect_decay, max_attempts)
@max_reconnect_interval = max_reconnect_interval
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is not needed as the logical bug here but for the sake of micro optimisation, I am changing it.

#
# Module Reconnect provides Reconnection Support
#
# @author Piyush Wani <piyush.wani@amuratech.com>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change email to your github email_id

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok thanks

#
# @author Piyush Wani <piyush.wani@amuratech.com>
#
module Reconnect
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please run: rubocop --autocorrect

Copy link
Collaborator Author

@peiyush13 peiyush13 Jul 6, 2018

Choose a reason for hiding this comment

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

done

socket.connect
socket.set_reconnection(false) # default reconnection is true
socket.max_attempts = 5
socket.reconnect
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we also add an example, if we set_reconnection to true?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

set_reconnction method is for automatic reconnection and one should not manually reconnect if auto_reconnection is enabled. so no need to add an example for that

Changed code as per the Rubocop generated suggestions
@maanavshah maanavshah merged commit a60ab50 into develop Jul 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants