Timestamps from the API seem to get deserialized wrongly

オープン
#29 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
java, kotlin
領域
api, backend

調査の方向性

SDKがV2 APIのレスポンスをデシリアライズするために使用しているobjectMapperから始め、次にUpdateUsersRequestの例と返されるcreatedAtおよびupdatedAtフィールドを使って問題を再現します。APIで使用されている時間単位を確認し、マイクロ秒のタイムスタンプが年55808194になるのではなく、正しい日付に変換されることを検証します。

索引モデルが issue の本文から書いたものです。

説明

I will just lead with some example code (it's kotlin, hope its okay, but the gist should be clear)

fun main() {
  val client = StreamSDKClient()
  val updateUsersRequest = UpdateUsersRequest().apply {
    users = mapOf("test" to UserRequest().apply {
      id = "tester"
      name = "Tester"
    })
  }
  client.updateUsers(
    updateUsersRequest
  ).execute().data.users.forEach {
    println(it)
  }
}

The output looks like this:

tester=FullUserResponse(banned=false, createdAt=Thu May 22 23:25:49 CEST 55808194, id=tester, invisible=false, language=, online=false, role=user, shadowBanned=false, totalUnreadCount=0, unreadChannels=0, unreadCount=0, unreadThreads=0, updatedAt=Thu May 22 23:25:49 CEST 55808194, blockedUserIds=[], channelMutes=[], devices=[], mutes=[], teams=[], custom={}, avgResponseTime=null, banExpires=null, deactivatedAt=null, deletedAt=null, image=null, lastActive=null, name=Tester, revokeTokensIssuedBefore=null, latestHiddenChannels=null, privacySettings=null, teamsRole=null)

As you see, the date is completely off: createdAt=Thu May 22 23:25:49 CEST 55808194 which is (roughly, maybe due to precission issues) the value if you multiply the current timestamp with 1e6.

The reasons seems to be that the V2 api responds with timestamps in microseconds resulution (e.g. 1761074344387549000), but the objectMapper the SDK is using to deserialize the response is not configured to understand these timestamps.

It's not a grave issue for us since we are not using this timestamp. I just noticed and thought I should share.

主要言語
Java
スター
3
フォーク
2
平均マージ
4時間 31分
マージ済み PR(30日)
6

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

GetStream/stream-sdk-java のほかの issue

GetStream/stream-sdk-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。