Example #1
0
func New(readabilityToken, postmarkToken, fromEmailAddress string, kindlegenBinary string, logger *log.Logger) *App {
	return &App{
		kindlegen:   kindlegenBinary,
		postmark:    postmark.New(postmarkToken),
		readability: readability.New(readabilityToken, nil),
		from:        fromEmailAddress,
	}
}
Example #2
0
	"time"
)

const (
	FriendlyMessage = "Sorry, extraction failed."
	RetryTimes      = 3
	RetryPause      = 3 * time.Second
)

type JSON map[string]interface{}

var (
	timeout = 5 * time.Second
	token   = env.String("READABILITY_TOKEN")
	logger  = log.New(os.Stdout, "[extractor] ", env.IntDefault("LOG_FLAGS", log.LstdFlags|log.Lmicroseconds))
	rdb     = readability.New(token, logger)
)

type Extractor struct {
	rdb    *readability.Endpoint
	wg     sync.WaitGroup
	Input  <-chan J.Job
	Output chan<- J.Job
	Error  chan<- J.Job
}

func New(rdb *readability.Endpoint, input <-chan J.Job, output chan<- J.Job, error chan<- J.Job) *Extractor {
	return &Extractor{
		rdb:    rdb,
		Input:  input,
		Output: output,