init log using getLog (#7886)

This commit is contained in:
Samuel Newman
2025-03-03 23:41:13 +00:00
committed by GitHub
parent 8b6dde17fd
commit 7222d6fe52
+9 -8
View File
@@ -235,20 +235,21 @@ export class MessagesEventBus {
try {
const response = await networkRetry(2, () => {
return this.agent.api.chat.bsky.convo.listConvos(
{
limit: 1,
},
return this.agent.chat.bsky.convo.getLog(
{},
{headers: DM_SERVICE_HEADERS},
)
})
// throw new Error('UNCOMMENT TO TEST INIT FAILURE')
const {convos} = response.data
const {cursor} = response.data
for (const convo of convos) {
if (convo.rev > (this.latestRev = this.latestRev || convo.rev)) {
this.latestRev = convo.rev
// should always be defined
if (cursor) {
if (!this.latestRev) {
this.latestRev = cursor
} else if (cursor > this.latestRev) {
this.latestRev = cursor
}
}