Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idle connections are never replaced after timeout #259

Closed
fmoor opened this issue Feb 9, 2023 · 0 comments · Fixed by #260
Closed

Idle connections are never replaced after timeout #259

fmoor opened this issue Feb 9, 2023 · 0 comments · Fixed by #260
Assignees
Labels
bug Something isn't working

Comments

@fmoor
Copy link
Member

fmoor commented Feb 9, 2023

When a connection is closed because it's idle timeout expires the connection is never replaced which effectively reduces the pool's concurrency by 1.

Version:
github.com/edgedb/edgedb-go v0.13.4

Reproduction

package main

import (
	"context"
	"fmt"
	"log"
	"time"

	"github.com/edgedb/edgedb-go"
)

func query(ctx context.Context, db *edgedb.Client) error {
	var result int64
	return db.QuerySingle(ctx, `select 1 + 1`, &result)
}

func main() {
	ctx, cancel := context.WithTimeout(context.Background(), 65*time.Second)
	defer cancel()

	client, err := edgedb.CreateClient(ctx, edgedb.Options{Concurrency: 1})
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("first query")
	err = query(ctx, client)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("sleeping...")
	time.Sleep(60 * time.Second)
	fmt.Println("second query")
	err = query(ctx, client)
	if err != nil {
		log.Fatal(err)
	}
}
@fmoor fmoor added the bug Something isn't working label Feb 9, 2023
@fmoor fmoor self-assigned this Feb 9, 2023
fmoor added a commit that referenced this issue Feb 9, 2023
fixes #259

This fixes a connection pooling bug that would permanently remove a
connection from the pool if it's idle timeout expired. This effectively
reduced the pools concurrency by one every time an idle timeout was reached.
@fmoor fmoor closed this as completed in #260 Feb 9, 2023
fmoor added a commit that referenced this issue Feb 9, 2023
fixes #259

This fixes a connection pooling bug that would permanently remove a
connection from the pool if it's idle timeout expired. This effectively
reduced the pools concurrency by one every time an idle timeout was reached.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant