Last active
August 4, 2023 10:19
-
-
Save moltar/eaf1628f77db5cbe5068ecfa3608d17f to your computer and use it in GitHub Desktop.
Tailscale test patch for https://github.com/tailscale/tailscale/issues/8785#issuecomment-1664934093
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ipn/store/awsstore/store_aws.go b/ipn/store/awsstore/store_aws.go | |
index 0fb78d45..f233573c 100644 | |
--- a/ipn/store/awsstore/store_aws.go | |
+++ b/ipn/store/awsstore/store_aws.go | |
@@ -7,9 +7,11 @@ | |
package awsstore | |
import ( | |
+ "bytes" | |
"context" | |
"errors" | |
"fmt" | |
+ "log" | |
"regexp" | |
"github.com/aws/aws-sdk-go-v2/aws" | |
@@ -149,6 +151,11 @@ func (s *awsStore) ReadState(id ipn.StateKey) (bs []byte, err error) { | |
// WriteState implements the Store interface. | |
func (s *awsStore) WriteState(id ipn.StateKey, bs []byte) (err error) { | |
+ if was, err := s.memory.ReadState(id); err == nil && bytes.Equal(was, bs) { | |
+ log.Printf("XXX useless write of %q", id) | |
+ return nil | |
+ } | |
+ | |
// Write the state in-memory | |
if err = s.memory.WriteState(id, bs); err != nil { | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment