Skip to content

Instantly share code, notes, and snippets.

@moltar
Last active August 4, 2023 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moltar/eaf1628f77db5cbe5068ecfa3608d17f to your computer and use it in GitHub Desktop.
Save moltar/eaf1628f77db5cbe5068ecfa3608d17f to your computer and use it in GitHub Desktop.
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