Remove EverySeconds(), reduce rate limit
This commit is contained in:
@@ -38,7 +38,7 @@ type nextPage struct {
|
||||
func NewClient(token string) *Client {
|
||||
c := &Client{
|
||||
client: &http.Client{},
|
||||
rateLimit: NewRateLimitPerMinute(1500, 1500),
|
||||
rateLimit: NewRateLimitPerMinute(600, 10),
|
||||
concurrencyLimitRead: NewConcurrencyLimit(50),
|
||||
concurrencyLimitWrite: NewConcurrencyLimit(15),
|
||||
}
|
||||
|
||||
21
main.go
21
main.go
@@ -3,8 +3,7 @@ package main
|
||||
import . "github.com/firestuff/automana/rules"
|
||||
|
||||
func main() {
|
||||
EverySeconds(30).
|
||||
InWorkspace("flamingcow.io").
|
||||
InWorkspace("flamingcow.io").
|
||||
InMyTasksSections("Recently Assigned", "Meetings", "Tonight", "Upcoming", "Later", "Someday").
|
||||
OnlyIncomplete().
|
||||
DueInDays(0).
|
||||
@@ -12,8 +11,7 @@ func main() {
|
||||
PrintTasks().
|
||||
MoveToMyTasksSection("Today")
|
||||
|
||||
EverySeconds(30).
|
||||
InWorkspace("flamingcow.io").
|
||||
InWorkspace("flamingcow.io").
|
||||
InMyTasksSections("Recently Assigned", "Today", "Meetings", "Maybe Today", "Upcoming", "Later", "Someday").
|
||||
OnlyIncomplete().
|
||||
DueInDays(0).
|
||||
@@ -21,8 +19,7 @@ func main() {
|
||||
PrintTasks().
|
||||
MoveToMyTasksSection("Tonight")
|
||||
|
||||
EverySeconds(30).
|
||||
InWorkspace("flamingcow.io").
|
||||
InWorkspace("flamingcow.io").
|
||||
InMyTasksSections("Recently Assigned", "Today", "Maybe Today", "Tonight", "Upcoming", "Later", "Someday").
|
||||
OnlyIncomplete().
|
||||
DueInDays(0).
|
||||
@@ -30,8 +27,7 @@ func main() {
|
||||
PrintTasks().
|
||||
MoveToMyTasksSection("Meetings")
|
||||
|
||||
EverySeconds(30).
|
||||
InWorkspace("flamingcow.io").
|
||||
InWorkspace("flamingcow.io").
|
||||
InMyTasksSections("Recently Assigned", "Today", "Meetings", "Maybe Today", "Tonight", "Later", "Someday").
|
||||
OnlyIncomplete().
|
||||
DueInAtLeastDays(1).
|
||||
@@ -39,24 +35,21 @@ func main() {
|
||||
PrintTasks().
|
||||
MoveToMyTasksSection("Upcoming")
|
||||
|
||||
EverySeconds(30).
|
||||
InWorkspace("flamingcow.io").
|
||||
InWorkspace("flamingcow.io").
|
||||
InMyTasksSections("Recently Assigned", "Today", "Meetings", "Maybe Today", "Tonight", "Upcoming", "Someday").
|
||||
OnlyIncomplete().
|
||||
DueInAtLeastDays(8).
|
||||
PrintTasks().
|
||||
MoveToMyTasksSection("Later")
|
||||
|
||||
EverySeconds(30).
|
||||
InWorkspace("flamingcow.io").
|
||||
InWorkspace("flamingcow.io").
|
||||
InMyTasksSections("Today", "Meetings", "Tonight", "Upcoming", "Later").
|
||||
OnlyIncomplete().
|
||||
WithoutDue().
|
||||
PrintTasks().
|
||||
MoveToMyTasksSection("Someday")
|
||||
|
||||
EverySeconds(30).
|
||||
InWorkspace("flamingcow.io").
|
||||
InWorkspace("flamingcow.io").
|
||||
InMyTasksSections("Recently Assigned", "Today", "Meetings", "Maybe Today", "Tonight", "Upcoming", "Later", "Someday").
|
||||
OnlyIncomplete().
|
||||
WithUnlinkedURL().
|
||||
|
||||
@@ -16,8 +16,7 @@ type taskFilter func(*client.WorkspaceClient, *client.Task) (bool, error)
|
||||
type workspaceClientGetter func(*client.Client) (*client.WorkspaceClient, error)
|
||||
|
||||
type periodic struct {
|
||||
period int
|
||||
done chan bool
|
||||
done chan bool
|
||||
|
||||
workspaceClientGetter workspaceClientGetter
|
||||
queryMutators []queryMutator
|
||||
@@ -27,18 +26,6 @@ type periodic struct {
|
||||
|
||||
var periodics = []*periodic{}
|
||||
|
||||
// TODO: Remove this, as it's now ignored
|
||||
func EverySeconds(seconds int) *periodic {
|
||||
ret := &periodic{
|
||||
period: seconds,
|
||||
done: make(chan bool),
|
||||
}
|
||||
|
||||
periodics = append(periodics, ret)
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func Loop() {
|
||||
c := client.NewClientFromEnv()
|
||||
|
||||
@@ -51,16 +38,17 @@ func Loop() {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *periodic) InWorkspace(name string) *periodic {
|
||||
if p.workspaceClientGetter != nil {
|
||||
panic("Multiple calls to InWorkspace()")
|
||||
func InWorkspace(name string) *periodic {
|
||||
ret := &periodic{
|
||||
done: make(chan bool),
|
||||
workspaceClientGetter: func(c *client.Client) (*client.WorkspaceClient, error) {
|
||||
return c.InWorkspace(name)
|
||||
},
|
||||
}
|
||||
|
||||
p.workspaceClientGetter = func(c *client.Client) (*client.WorkspaceClient, error) {
|
||||
return c.InWorkspace(name)
|
||||
}
|
||||
periodics = append(periodics, ret)
|
||||
|
||||
return p
|
||||
return ret
|
||||
}
|
||||
|
||||
// Query mutators
|
||||
|
||||
Reference in New Issue
Block a user