Skip to content
Permalink
Browse files
truncate stage and step error messages for pg
  • Loading branch information
bradrydzewski committed May 21, 2020
1 parent d1a2f21 commit dff798a4d18d851f8e320e432c973bd3691d3288
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
@@ -76,6 +76,9 @@ func (s *setup) do(ctx context.Context, stage *core.Stage) error {
// return err
// }

if len(stage.Error) > 500 {
stage.Error = stage.Error[:500]
}
stage.Updated = time.Now().Unix()
err = s.Stages.Update(noContext, stage)
if err != nil {
@@ -86,6 +89,9 @@ func (s *setup) do(ctx context.Context, stage *core.Stage) error {
}

for _, step := range stage.Steps {
if len(step.Error) > 500 {
step.Error = step.Error[:500]
}
err := s.Steps.Create(noContext, step)
if err != nil {
logger.WithError(err).
@@ -65,6 +65,9 @@ func (t *teardown) do(ctx context.Context, stage *core.Stage) error {
}

for _, step := range stage.Steps {
if len(step.Error) > 500 {
step.Error = step.Error[:500]
}
err := t.Steps.Update(noContext, step)
if err != nil {
logger.WithError(err).
@@ -76,6 +79,10 @@ func (t *teardown) do(ctx context.Context, stage *core.Stage) error {
}
}

if len(stage.Error) > 500 {
stage.Error = stage.Error[:500]
}

stage.Updated = time.Now().Unix()
err = t.Stages.Update(noContext, stage)
if err != nil {
@@ -41,6 +41,9 @@ func (u *updater) do(ctx context.Context, step *core.Step) error {
},
)

if len(step.Error) > 500 {
step.Error = step.Error[:500]
}
err := u.Steps.Update(noContext, step)
if err != nil {
logger.WithError(err).Warnln("manager: cannot update step")

0 comments on commit dff798a

Please sign in to comment.