init log using getLog (#7886)
This commit is contained in:
@@ -235,20 +235,21 @@ export class MessagesEventBus {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await networkRetry(2, () => {
|
const response = await networkRetry(2, () => {
|
||||||
return this.agent.api.chat.bsky.convo.listConvos(
|
return this.agent.chat.bsky.convo.getLog(
|
||||||
{
|
{},
|
||||||
limit: 1,
|
|
||||||
},
|
|
||||||
{headers: DM_SERVICE_HEADERS},
|
{headers: DM_SERVICE_HEADERS},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
// throw new Error('UNCOMMENT TO TEST INIT FAILURE')
|
// throw new Error('UNCOMMENT TO TEST INIT FAILURE')
|
||||||
|
|
||||||
const {convos} = response.data
|
const {cursor} = response.data
|
||||||
|
|
||||||
for (const convo of convos) {
|
// should always be defined
|
||||||
if (convo.rev > (this.latestRev = this.latestRev || convo.rev)) {
|
if (cursor) {
|
||||||
this.latestRev = convo.rev
|
if (!this.latestRev) {
|
||||||
|
this.latestRev = cursor
|
||||||
|
} else if (cursor > this.latestRev) {
|
||||||
|
this.latestRev = cursor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user