210
idx, err := versionhistory.FindFirstVersionHistoryIndexByVersionHistoryItem(versionHistories, endItem)
211
if err != nil {
212
>
// Since the API is exclusive-exclusive, EndEventId is the first event we don't want.
api.go
213
>
// If {EndEventId, EndEventVersion} is not found, it might be because the branch ends
214
>
// exactly at EndEventId-1. In that case, try to find a branch containing {EndEventId-1, EndEventVersion}.
215
>
actualLastEventID := req.GetEndEventId() - 1
216
>
if actualLastEventID >= common.FirstEventID {
217
>
endItem = versionhistory.NewVersionHistoryItem(actualLastEventID, req.GetEndEventVersion())
218
>
idx, err = versionhistory.FindFirstVersionHistoryIndexByVersionHistoryItem(versionHistories, endItem)
219
>
}
220
>
if err != nil {
221
return nil, err
222
}