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