Use new jet query for getting users from org ID
Some checks failed
/ golint (push) Has been cancelled

This is to try to avoid an area where we know our query pool is getting
blocked. Related to issue #3.
This commit is contained in:
Eli Ribble 2026-05-19 14:43:20 +00:00
parent 85957b5ae6
commit 77ea99647e
No known key found for this signature in database

View file

@ -25,6 +25,7 @@ import (
"github.com/Gleipnir-Technology/nidus-sync/db/gen/nidus-sync/arcgis/model" "github.com/Gleipnir-Technology/nidus-sync/db/gen/nidus-sync/arcgis/model"
"github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/Gleipnir-Technology/nidus-sync/db/models"
queryarcgis "github.com/Gleipnir-Technology/nidus-sync/db/query/arcgis" queryarcgis "github.com/Gleipnir-Technology/nidus-sync/db/query/arcgis"
querypublic "github.com/Gleipnir-Technology/nidus-sync/db/query/public"
"github.com/Gleipnir-Technology/nidus-sync/db/sql" "github.com/Gleipnir-Technology/nidus-sync/db/sql"
"github.com/Gleipnir-Technology/nidus-sync/debug" "github.com/Gleipnir-Technology/nidus-sync/debug"
"github.com/Gleipnir-Technology/nidus-sync/h3utils" "github.com/Gleipnir-Technology/nidus-sync/h3utils"
@ -55,7 +56,7 @@ func IsSyncOngoing(org_id int32) bool {
return syncStatusByOrg[org_id] return syncStatusByOrg[org_id]
} }
func getOAuthForOrg(ctx context.Context, org *models.Organization) (*model.OAuthToken, error) { func getOAuthForOrg(ctx context.Context, org *models.Organization) (*model.OAuthToken, error) {
users, err := org.User().All(ctx, db.PGInstance.BobDB) users, err := querypublic.UsersFromOrganizationID(ctx, db.PGInstance.PGXPool, int64(org.ID))
if err != nil { if err != nil {
return nil, fmt.Errorf("Failed to query all users for org: %w", err) return nil, fmt.Errorf("Failed to query all users for org: %w", err)
} }
@ -649,7 +650,6 @@ func markTokenFailed(ctx context.Context, oauth *model.OAuthToken) {
log.Info().Int("id", int(oauth.ID)).Msg("Marked oauth token invalid") log.Info().Int("id", int(oauth.ID)).Msg("Marked oauth token invalid")
} }
/* /*
func saveRawQuery(fssync fieldseeker.FieldSeeker, layer arcgis.LayerFeature, query *arcgis.Query, filename string) { func saveRawQuery(fssync fieldseeker.FieldSeeker, layer arcgis.LayerFeature, query *arcgis.Query, filename string) {
output, err := os.Create(filename) output, err := os.Create(filename)
@ -673,7 +673,6 @@ func saveRawQuery(fssync fieldseeker.FieldSeeker, layer arcgis.LayerFeature, que
} }
*/ */
func exportFieldseekerLayer(ctx context.Context, group pond.ResultTaskGroup[SyncStats], org *models.Organization, fssync *fieldseeker.FieldSeeker, layer response.Layer) (SyncStats, error) { func exportFieldseekerLayer(ctx context.Context, group pond.ResultTaskGroup[SyncStats], org *models.Organization, fssync *fieldseeker.FieldSeeker, layer response.Layer) (SyncStats, error) {
var stats SyncStats var stats SyncStats
return stats, nil return stats, nil