Skip to content

Add link to implementation for CockroachDB - #219

Merged
elithrar merged 1 commit into
gorilla:masterfrom
stephenafamo:patch-1
Jul 13, 2020
Merged

elithrar merged 1 commit into
gorilla:masterfrom
stephenafamo:patch-1

Conversation

@stephenafamo

@stephenafamo stephenafamo commented Jul 13, 2020 •

Copy link
Copy Markdown
Contributor

No description provided.

@elithrar

elithrar commented Jul 13, 2020 •

Copy link
Copy Markdown
Contributor

Thanks for this - I did however notice that your README example opens a new connection for every client request, as well as leaking goroutines.

I suggest pulling these lines out into the main() of your program:

	// Fetch new store.
	store, err := crdbstore.NewCrDBStore("postgres://user:[email protected]:5432/database?sslmode=verify-full", []byte("secret-key"))
	if err != nil {
		log.Fatalf(err.Error())
	}
	defer store.Close()

	// Run a background goroutine to clean up expired sessions from the database.
	defer store.StopCleanup(store.Cleanup(time.Minute * 5))

@elithrar elithrar self-assigned this Jul 13, 2020
@stephenafamo

Copy link
Copy Markdown
Contributor Author

Thanks for pointing that out.

I've updated the example accordingly.

@elithrar
elithrar merged commit 947297c into gorilla:master Jul 13, 2020
@elithrar

Copy link
Copy Markdown
Contributor

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants