From 1c99661d8cfbafa86ea186a3d0c8f07993a122a9 Mon Sep 17 00:00:00 2001
From: Nick Craig-Wood <nick@craig-wood.com>
Date: Thu, 15 Sep 2022 17:18:35 +0100
Subject: [PATCH] onedrive: disable change notify in China region since it is
 not supported

Fixes #6444
---
 backend/onedrive/onedrive.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/backend/onedrive/onedrive.go b/backend/onedrive/onedrive.go
index 29afd3976..e7674c019 100644
--- a/backend/onedrive/onedrive.go
+++ b/backend/onedrive/onedrive.go
@@ -891,6 +891,12 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
 	}).Fill(ctx, f)
 	f.srv.SetErrorHandler(errorHandler)
 
+	// Disable change polling in China region
+	// See: https://github.com/rclone/rclone/issues/6444
+	if f.opt.Region == regionCN {
+		f.features.ChangeNotify = nil
+	}
+
 	// Renew the token in the background
 	f.tokenRenewer = oauthutil.NewRenew(f.String(), ts, func() error {
 		_, _, err := f.readMetaDataForPath(ctx, "")