MCPcopy Create free account
hub / github.com/cloudspannerecosystem/spanner-cli / heartbeat

Function heartbeat

session.go:397–404  ·  view source on GitHub ↗
(txn *spanner.ReadWriteStmtBasedTransaction, priority pb.RequestOptions_Priority)

Source from the content-addressed store, hash-verified

395}
396
397func heartbeat(txn *spanner.ReadWriteStmtBasedTransaction, priority pb.RequestOptions_Priority) error {
398 ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
399 defer cancel()
400 iter := txn.QueryWithOptions(ctx, spanner.NewStatement("SELECT 1"), spanner.QueryOptions{Priority: priority})
401 defer iter.Stop()
402 _, err := iter.Next()
403 return err
404}
405
406func parseDirectedReadOption(directedReadOptionText string) (*pb.DirectedReadOptions, error) {
407 directedReadOption := strings.Split(directedReadOptionText, ":")

Callers 1

startHeartbeatMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected