-
Notifications
You must be signed in to change notification settings - Fork 15
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
refactor!: Update App Concurrency Model #30
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice refactor!
internal/sink/stdout.go
Outdated
select { | ||
case <-kill: | ||
case <-ctx.Done(): | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this return ctx.Err()
as well as the others?
process/for_each.go
Outdated
@@ -11,7 +11,7 @@ import ( | |||
) | |||
|
|||
/* | |||
ForEach processes data by iterating and applying a processor to each element in a JSON array. The processor supports these patterns: | |||
ForEach processes data by iterating anding a processor to each element in a JSON array. The processor supports these patterns: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: grammatical error here
@@ -44,7 +44,7 @@ type ForEach struct { | |||
/* | |||
ForEachOptions contains custom options for the ForEach processor: | |||
Processor: | |||
processor to apply to the data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: grammatical error here
process/math.go
Outdated
@@ -9,7 +9,7 @@ import ( | |||
) | |||
|
|||
/* | |||
Math processes data by applying mathematic operations. The processor supports these patterns: | |||
Math processes data bying mathematic operations. The processor supports these patterns: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: grammatical error here
process/pipeline.go
Outdated
|
||
/* | ||
Pipeline processes data by applying a series of processors. This processor should be used when data requires complex processing outside of the boundaries of any data structures (see tests for examples). The processor supports these patterns: | ||
Pipeline processes data bying a series of processors. This processor should be used when data requires complex processing outside of the boundaries of any data structures (see tests for examples). The processor supports these patterns: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: grammatical error here
process/pipeline.go
Outdated
@@ -58,7 +58,7 @@ type Pipeline struct { | |||
/* | |||
PipelineOptions contains custom options for the Pipeline processor: | |||
Processors: | |||
array of processors to apply to the data | |||
array of processors to to the data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: grammatical error here
process/pretty_print.go
Outdated
|
||
/* | ||
PrettyPrint processes data by applying or reversing prettyprint formatting to JSON. | ||
PrettyPrint processes data bying or reversing prettyprint formatting to JSON. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: grammatical error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Left a couple comments on typos in documentation but NBD
@@ -2,26 +2,307 @@ | |||
|
|||
Thank you so much for your interest in contributing to Substation! This document contains guidelines to follow when contributing to the project. | |||
|
|||
## Table Of Contents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow love the reformatting of the documentation 👏🏻
process/hash.go
Outdated
@@ -43,7 +45,7 @@ type Hash struct { | |||
/* | |||
HashOptions contains custom options for the Hash processor: | |||
Algorithm: | |||
the hashing algorithm to apply | |||
the hashing algorithm to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the hashing algorithm to must be..
process/math.go
Outdated
@@ -9,7 +9,7 @@ import ( | |||
) | |||
|
|||
/* | |||
Math processes data by applying mathematic operations. The processor supports these patterns: | |||
Math processes data bying mathematic operations. The processor supports these patterns: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: by applying
process/pipeline.go
Outdated
|
||
/* | ||
Pipeline processes data by applying a series of processors. This processor should be used when data requires complex processing outside of the boundaries of any data structures (see tests for examples). The processor supports these patterns: | ||
Pipeline processes data bying a series of processors. This processor should be used when data requires complex processing outside of the boundaries of any data structures (see tests for examples). The processor supports these patterns: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: by applying
process/pretty_print.go
Outdated
|
||
/* | ||
PrettyPrint processes data by applying or reversing prettyprint formatting to JSON. | ||
PrettyPrint processes data bying or reversing prettyprint formatting to JSON. | ||
This processor has significant limitations when used to reverse prettyprint, including: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: by applying
process/process.go
Outdated
@@ -322,7 +319,7 @@ func newBatch(s *[]config.Capsule) []config.Capsule { | |||
return make([]config.Capsule, 0, 10) | |||
} | |||
|
|||
// conditionallyApplyBatch uses conditions to dynamically apply processors to a slice of encapsulated data. This is a convenience function for the ApplyBatch method used in most processors. | |||
// conditionallyApplyBatch uses conditions to dynamically processors to a slice of encapsulated data. This is a convenience function for the ApplyBatch method used in most processors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: to dynamically apply processors
Description
:pk
and sort keys as:sk
Motivation and Context
For the concurrency model refactor, we've known for a while that the existing design has a risk of leaking goroutines when data processing errors happen, but fixing this wasn't a priority because we've never observed it as an issue since the system runs in AWS Lambda (over time the "serverless container" that the application runs in is reaped, cleaning up lingering goroutines).
Now is as good a time as any to try and improve the design, so this PR replaces the Errs and Kill channels with an errgroup and derived context. Functionally this is the same, but provides two advantages for reliability:
The only significant change in this refactor is the introduction of a Channel struct that allows safer closing of and writing to channels. This was required to interrupt producer goroutines stuck on unbuffered channels when the consumer already terminated, but has an advantage of future proofing changes we might make to channel behavior.
References for these changes:
For the remaining changes, I think they are self-explanatory -- mostly focused on standardizing our approach to conventions across the system with supported documentation.
How Has This Been Tested?
Types of changes
Checklist: