Skip to content

Add link to implementation for CockroachDB#219

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

Add link to implementation for CockroachDB#219
elithrar merged 1 commit intogorilla:masterfrom
stephenafamo:patch-1

Conversation

@stephenafamo
Copy link
Contributor

@stephenafamo stephenafamo commented Jul 13, 2020

No description provided.

@elithrar
Copy link
Contributor

elithrar commented Jul 13, 2020

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:password@127.0.0.1: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
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
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