Skip to content

Commit f7ecbf5

Browse files
committed
Aviato updates
1 parent d77bd7f commit f7ecbf5

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

engine/plugins/api/aviato/company_search.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func (cs *companySearch) query(e *et.Event, orgent *dbt.Entity, apikey []string)
9090
headers["Authorization"] = []string{"Bearer " + key}
9191

9292
_ = cs.plugin.rlimit.Wait(context.TODO())
93-
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
93+
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
9494
defer cancel()
9595

9696
filters := []map[string]*dslEvalObj{
@@ -134,10 +134,10 @@ func (cs *companySearch) query(e *et.Event, orgent *dbt.Entity, apikey []string)
134134
return nil
135135
}
136136

137-
return cs.store(e, orgent, result.Items[0].ID, 90)
137+
return cs.store(e, orgent, result.Items[0].ID)
138138
}
139139

140-
func (cs *companySearch) store(e *et.Event, orgent *dbt.Entity, companyID string, conf int) *dbt.Entity {
140+
func (cs *companySearch) store(e *et.Event, orgent *dbt.Entity, companyID string) *dbt.Entity {
141141
oamid := &general.Identifier{
142142
UniqueID: fmt.Sprintf("%s:%s", AviatoCompanyID, companyID),
143143
ID: companyID,
@@ -151,10 +151,11 @@ func (cs *companySearch) store(e *et.Event, orgent *dbt.Entity, companyID string
151151

152152
_, _ = e.Session.Cache().CreateEntityProperty(ident, &general.SourceProperty{
153153
Source: cs.plugin.source.Name,
154-
Confidence: conf,
154+
Confidence: cs.plugin.source.Confidence,
155155
})
156156

157-
if err := cs.plugin.createRelation(e.Session, orgent, general.SimpleRelation{Name: "id"}, ident, conf); err != nil {
157+
if err := cs.plugin.createRelation(e.Session, orgent,
158+
general.SimpleRelation{Name: "id"}, ident, cs.plugin.source.Confidence); err != nil {
158159
return nil
159160
}
160161
return ident

engine/plugins/api/aviato/employees.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ loop:
118118
headers["Authorization"] = []string{"Bearer " + key}
119119

120120
_ = ae.plugin.rlimit.Wait(context.TODO())
121-
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
121+
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
122122
defer cancel()
123123

124124
u := fmt.Sprintf("https://data.api.aviato.co/company/%s/employees?perPage=%d&page=%d", oamid.ID, perPage, page)
@@ -183,10 +183,11 @@ func (ae *employees) store(e *et.Event, ident *dbt.Entity, employlist []*employe
183183

184184
_, _ = e.Session.Cache().CreateEntityProperty(ident, &general.SourceProperty{
185185
Source: ae.plugin.source.Name,
186-
Confidence: 90,
186+
Confidence: ae.plugin.source.Confidence,
187187
})
188188

189-
if err := ae.plugin.createRelation(e.Session, orgent, general.SimpleRelation{Name: "member"}, personent, 90); err == nil {
189+
if err := ae.plugin.createRelation(e.Session, orgent,
190+
general.SimpleRelation{Name: "member"}, personent, ae.plugin.source.Confidence); err == nil {
190191
employents = append(employents, personent)
191192
}
192193
}

engine/plugins/api/aviato/plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
)
1717

1818
func NewAviato() et.Plugin {
19-
limit := rate.Every(time.Second)
19+
limit := rate.Every(2 * time.Second)
2020

2121
return &aviato{
2222
name: "Aviato",

engine/plugins/api/aviato/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
)
1313

1414
const (
15+
AviatoPersonID = "aviato_person_id"
1516
AviatoCompanyID = "aviato_company_id"
1617
)
1718

0 commit comments

Comments
 (0)