objectbox / objectbox/objectbox-java

Improve DataObserver reference holding

未关闭
#215 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

enhancement help wanted
主要语言
Java
星标
4.6k
派生
311
PR 合并指标
30 天内没有已合并 PR

描述

I'm trying to use obervable queries to detect when the user is logged in my application in order to start fetching data in background with correct authorization token.

    ...
    userBox.query().build().subscribe().observe(users -> fetchUserData());
    ...
    boxStore.subscribe(User.class).observe(class -> fetchUserData());

First "live" query doesn't work whilst the second works fine whenever I put(user) a new user in the userBox.

Is this correct? I'm not sure from which thread the user is being inserted, might this be an issue?
Does it make sense to use a "live" query to observe the insertion of new objects or is it just for changes in existing objects?
Live queries would be great, for my application and are the main feature that made me pick ObjectBox, hope I can get it working.

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先跟踪报告中描述的 DataObserver 和 live-query 订阅路径,然后将它们与 boxStore.subscribe(User.class) 进行比较。检查查询引用是如何持有的,以及哪个线程处理插入操作。完成的标准是 live query 能够可靠地观察到新插入的用户,并且相关行为已得到明确说明或由适当的测试覆盖。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
databases, mobile-dev
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。