2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

最善の書き込み方法について(主に速度)②※注意

Posted at

前回の記事
https://qiita.com/sionnct/items/05ac79a839c50f3f4f13#comment-191cf61e22eb8bd0c721
ではコレクションとデータベースの両方を書き込むと言うことでしたが
削除するときには順番に注意が必要です。
もちろんConcurrentを使って下記の様にしたいのですが
ギャラリーのItemをコレクションにした想定で

Concurrent(
    Remove(速度テスト,LookUp(速度テスト,ID=Gallery.Selected.ID)),
    Remove(col速度テスト,Gallery.Selected)
)

としたくなるのですがConcurrentを利用するとどちらが先に実行されるかわかりません。
そのため

Remove(col速度テスト,Gallery.Selected)

こちらが先に実行された場合

Remove(速度テスト,LookUp(速度テスト,ID=Gallery.Selected.ID))

この結果が変わる、もしくはエラーとなる可能性があるので
おとなしく

Remove(速度テスト,LookUp(速度テスト,ID=Gallery.Selected.ID));
Remove(col速度テスト,Gallery.Selected)

とするのが良いです。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?