Documentation ¶
Index ¶
- func NewFailedQueue(log *logger.Logger, af *apiFactory, heartbeat, poll time.Duration) sidejob.WorkerGroup
- func NewProcessQueue(log *logger.Logger, af *apiFactory, ...) sidejob.WorkerGroup
- type APIFactory
- type Config
- type Context
- func (c *Context) CheckPersistedData(gcs googlestorage.GCStorage) (bool, error)
- func (c *Context) IsAtMaxErrorCount(max int) bool
- func (c *Context) IsPastWaitingTime() bool
- func (c *Context) IsRateLimited() bool
- func (c *Context) IsSuccess() bool
- func (c *Context) LogRequestFailure(log *logger.Logger, name string)
- func (c *Context) LogRequestSuccess(log *logger.Logger, name string, fromStorage bool)
- func (c *Context) MarkAsProcessed()
- func (c *Context) PersistData(gcs googlestorage.GCStorage) error
- func (c *Context) Prepare()
- func (c *Context) QueueResponseError()
- func (c *Context) String(log *logger.Logger) string
- func (c *Context) UpdateNextProcessingTime(delta time.Duration)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFailedQueue ¶
func NewFailedQueue(log *logger.Logger, af *apiFactory, heartbeat, poll time.Duration) sidejob.WorkerGroup
NewFailedQueue returns a apifactory failed queue
func NewProcessQueue ¶
func NewProcessQueue(log *logger.Logger, af *apiFactory, heartbeat, poll, exponentialBase time.Duration, maxErrorCount int) sidejob.WorkerGroup
NewProcessQueue returns a new process queue
Types ¶
type APIFactory ¶
type APIFactory interface { Start(count int64) (chan interface{}, chan interface{}) Stop(ctx context.Context) UpdateProcess(count int64) UpdateFailed(count int64) AddRateLimit(host, bucket string, count int64) error Publish(cx *Context) error }
APIFactory ...
func NewAPIFactory ¶
func NewAPIFactory(conf *Config, log *logger.Logger, sj sidejob.Sidejob, gcstore googlestorage.GCStorage) (APIFactory, error)
NewAPIFactory returns a new APIfactory object
type Context ¶
type Context struct { Request *getter.Request Response *getter.Response Next time.Time Published time.Time Processed time.Time ProcessingTime time.Duration ParsedQueue string QueueErrors []string PersistHash string }
Context contains details about a request in apifactory
func NewContext ¶
NewContext creates a context from a string
func (*Context) CheckPersistedData ¶
func (c *Context) CheckPersistedData(gcs googlestorage.GCStorage) (bool, error)
CheckPersistedData ...
func (*Context) IsAtMaxErrorCount ¶
IsAtMaxErrorCount checks if the number of failures is equal to max
func (*Context) IsPastWaitingTime ¶
IsPastWaitingTime checks if the job is beyond the waiting time
func (*Context) IsRateLimited ¶
IsRateLimited checks if request was rate limited
func (*Context) LogRequestFailure ¶
LogRequestFailure logs a request failure
func (*Context) LogRequestSuccess ¶
LogRequestSuccess logs a successful request
func (*Context) MarkAsProcessed ¶
func (c *Context) MarkAsProcessed()
MarkAsProcessed update processed timestamp and processing time
func (*Context) PersistData ¶
func (c *Context) PersistData(gcs googlestorage.GCStorage) error
PersistData ...
func (*Context) QueueResponseError ¶
func (c *Context) QueueResponseError()
QueueResponseError adds the response error to the queue of error
func (*Context) UpdateNextProcessingTime ¶
UpdateNextProcessingTime updates the processing time to the next value