Skip to content

refactor PersistentPubSub - #185

Merged
mediocregopher merged 1 commit into
masterfrom
persistent-pub-sub-refactor
Feb 19, 2020
Merged

refactor PersistentPubSub#185
mediocregopher merged 1 commit into
masterfrom
persistent-pub-sub-refactor

Conversation

@mediocregopher

Copy link
Copy Markdown
Owner

The impetus for this change was issue #184, but after reviewing the code
I decided it needed a larger refactor just out of principal. The
original code was written to not use a central go-routine out of a
desire for simplicity, but in the end it ended up still needing
go-routines, and the interacting between them and the locks was anything
but simple.

The new code has a simple go-routine loop which acts in an RPC pattern,
while also monitoring the underlying PubSubConn. It's much easier to
think about than the old code, and not as buggy.

The impetus for this change was issue #184, but after reviewing the code
I decided it needed a larger refactor just out of principal. The
original code was written to not use a central go-routine out of a
desire for simplicity, but in the end it ended up still needing
go-routines, and the interacting between them and the locks was anything
but simple.

The new code has a simple go-routine loop which acts in an RPC pattern,
while also monitoring the underlying PubSubConn. It's much easier to
think about than the old code, and not as buggy.

@nussjustin nussjustin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

This is so much easier to read than the old code.

@mediocregopher
mediocregopher merged commit e708687 into master Feb 19, 2020
@mediocregopher
mediocregopher deleted the persistent-pub-sub-refactor branch February 19, 2020 17:50
kataras added a commit to kataras/neffos that referenced this pull request Apr 28, 2020
LeeEirc pushed a commit to LeeEirc/neffos that referenced this pull request Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants