Source File
postgres.go
Belonging Package
golang.org/x/pkgsite/internal/postgres
var startPoller = true
func ( *database.DB, bool) *DB {
:= poller.New(
[]string(nil),
func( context.Context) (interface{}, error) {
return getExcludedPrefixes(, )
},
func( error) {
log.Errorf(context.Background(), "getting excluded prefixes: %v", )
})
, := context.WithCancel(context.Background())
if startPoller {
.Poll() // Initialize the state.
.Start(, time.Minute)
}
return &DB{
db: ,
bypassLicenseCheck: ,
expoller: ,
cancel: ,
}
}
func ( *DB) ( context.Context) (time.Time, error) {
var time.Time
:= .db.QueryRow(, `
SELECT m.index_timestamp
FROM module_version_states m
CROSS JOIN (
-- the index timestamp of the youngest processed module
SELECT index_timestamp
FROM module_version_states
WHERE last_processed_at IS NOT NULL
ORDER BY 1 DESC
LIMIT 1
) yp
WHERE m.index_timestamp > yp.index_timestamp
AND last_processed_at IS NULL
ORDER BY m.index_timestamp ASC
LIMIT 1
`).Scan(&)
switch {
case nil:
return , nil
case sql.ErrNoRows:
return time.Time{}, derrors.NotFound
default:
return time.Time{},
}
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |