mirror of
https://github.com/harness/drone.git
synced 2025-05-05 04:30:50 +08:00
remove tx from list
This commit is contained in:
parent
2b633f9fd8
commit
2d91d3acf1
@ -9,7 +9,6 @@ import (
|
|||||||
|
|
||||||
apiauth "github.com/harness/gitness/internal/api/auth"
|
apiauth "github.com/harness/gitness/internal/api/auth"
|
||||||
"github.com/harness/gitness/internal/auth"
|
"github.com/harness/gitness/internal/auth"
|
||||||
"github.com/harness/gitness/store/database/dbtx"
|
|
||||||
"github.com/harness/gitness/types"
|
"github.com/harness/gitness/types"
|
||||||
"github.com/harness/gitness/types/enum"
|
"github.com/harness/gitness/types/enum"
|
||||||
)
|
)
|
||||||
@ -34,18 +33,16 @@ func (c *Controller) ListConnectors(
|
|||||||
var count int64
|
var count int64
|
||||||
var connectors []*types.Connector
|
var connectors []*types.Connector
|
||||||
|
|
||||||
err = dbtx.New(c.db).WithTx(ctx, func(ctx context.Context) (err error) {
|
count, err = c.connectorStore.Count(ctx, space.ID, filter)
|
||||||
count, err = c.connectorStore.Count(ctx, space.ID, filter)
|
if err != nil {
|
||||||
if err != nil {
|
return nil, 0, fmt.Errorf("failed to count child executions: %w", err)
|
||||||
return fmt.Errorf("failed to count child executions: %w", err)
|
}
|
||||||
}
|
|
||||||
|
connectors, err = c.connectorStore.List(ctx, space.ID, filter)
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, fmt.Errorf("failed to list child executions: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
connectors, err = c.connectorStore.List(ctx, space.ID, filter)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to list child executions: %w", err)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}, dbtx.TxDefaultReadOnly)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return connectors, count, fmt.Errorf("failed to list connectors: %w", err)
|
return connectors, count, fmt.Errorf("failed to list connectors: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
|
|
||||||
apiauth "github.com/harness/gitness/internal/api/auth"
|
apiauth "github.com/harness/gitness/internal/api/auth"
|
||||||
"github.com/harness/gitness/internal/auth"
|
"github.com/harness/gitness/internal/auth"
|
||||||
"github.com/harness/gitness/store/database/dbtx"
|
|
||||||
"github.com/harness/gitness/types"
|
"github.com/harness/gitness/types"
|
||||||
"github.com/harness/gitness/types/enum"
|
"github.com/harness/gitness/types/enum"
|
||||||
)
|
)
|
||||||
@ -34,20 +33,14 @@ func (c *Controller) ListTemplates(
|
|||||||
var count int64
|
var count int64
|
||||||
var templates []*types.Template
|
var templates []*types.Template
|
||||||
|
|
||||||
err = dbtx.New(c.db).WithTx(ctx, func(ctx context.Context) (err error) {
|
count, err = c.templateStore.Count(ctx, space.ID, filter)
|
||||||
count, err = c.templateStore.Count(ctx, space.ID, filter)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to count child executions: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
templates, err = c.templateStore.List(ctx, space.ID, filter)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to list child executions: %w", err)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}, dbtx.TxDefaultReadOnly)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return templates, count, fmt.Errorf("failed to list templates: %w", err)
|
return nil, 0, fmt.Errorf("failed to count templates in the space: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
templates, err = c.templateStore.List(ctx, space.ID, filter)
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, fmt.Errorf("failed to list templates: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return templates, count, nil
|
return templates, count, nil
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
|
|
||||||
apiauth "github.com/harness/gitness/internal/api/auth"
|
apiauth "github.com/harness/gitness/internal/api/auth"
|
||||||
"github.com/harness/gitness/internal/auth"
|
"github.com/harness/gitness/internal/auth"
|
||||||
"github.com/harness/gitness/store/database/dbtx"
|
|
||||||
"github.com/harness/gitness/types"
|
"github.com/harness/gitness/types"
|
||||||
"github.com/harness/gitness/types/enum"
|
"github.com/harness/gitness/types/enum"
|
||||||
)
|
)
|
||||||
@ -35,24 +34,14 @@ func (c *Controller) List(
|
|||||||
return nil, 0, fmt.Errorf("failed to authorize: %w", err)
|
return nil, 0, fmt.Errorf("failed to authorize: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var count int64
|
count, err := c.triggerStore.Count(ctx, pipeline.ID, filter)
|
||||||
var triggers []*types.Trigger
|
|
||||||
|
|
||||||
err = dbtx.New(c.db).WithTx(ctx, func(ctx context.Context) (err error) {
|
|
||||||
count, err = c.triggerStore.Count(ctx, pipeline.ID, filter)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to count child triggers: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
triggers, err = c.triggerStore.List(ctx, pipeline.ID, filter)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to list child triggers: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}, dbtx.TxDefaultReadOnly)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return triggers, count, fmt.Errorf("failed to fetch list: %w", err)
|
return nil, 0, fmt.Errorf("failed to count child triggers: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
triggers, err := c.triggerStore.List(ctx, pipeline.ID, filter)
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, fmt.Errorf("failed to list child triggers: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return triggers, count, nil
|
return triggers, count, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user