1. 分批同步数据遇到的bug

panic: runtime error: slice bounds out of range [:20] with capacity 10
当使用 arr[i:j] 时,j不能超过切片的容量否则会报上面的错误。
因此要加入一段判断代码

  1. // 正确的写法
  2. if len(arr) < j{
  3. j = len(arr)
  4. }