| 395 | } |
| 396 | |
| 397 | func 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 | |
| 406 | func parseDirectedReadOption(directedReadOptionText string) (*pb.DirectedReadOptions, error) { |
| 407 | directedReadOption := strings.Split(directedReadOptionText, ":") |