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),
|
||||||
}
|
}
|
||||||
|
|||||||
7
main.go
7
main.go
@@ -3,7 +3,6 @@ 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().
|
||||||
@@ -12,7 +11,6 @@ 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().
|
||||||
@@ -21,7 +19,6 @@ 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().
|
||||||
@@ -30,7 +27,6 @@ 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().
|
||||||
@@ -39,7 +35,6 @@ 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().
|
||||||
@@ -47,7 +42,6 @@ func main() {
|
|||||||
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().
|
||||||
@@ -55,7 +49,6 @@ func main() {
|
|||||||
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().
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ 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
|
||||||
@@ -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) {
|
||||||
|
|
||||||
p.workspaceClientGetter = func(c *client.Client) (*client.WorkspaceClient, error) {
|
|
||||||
return c.InWorkspace(name)
|
return c.InWorkspace(name)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return p
|
periodics = append(periodics, ret)
|
||||||
|
|
||||||
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
// Query mutators
|
// Query mutators
|
||||||
|
|||||||
Reference in New Issue
Block a user