Dim: EquipItems()

Created on 23 Oct 2015  ยท  24Comments  ยท  Source: DestinyItemManager/DIM

I'm not sure what happened to the original issue to track this, but there is an endpoint that allows you to pass in an array of items to equip.

This endpoint actually returns the character meta data to get the new light level, etc. (something we're requesting after an equip anyway)

We could even use this for single items, and that way we can reduce the need for an additional call.

For equipping a loadout, we could move all items... and in one call equip EVERYTHING.

Additional reading:
http://bungienetplatform.wikia.com/wiki/EquipItems

The main difference between /EquipItem and /EquipItems endpoints are that in place of passing the itemId you pass an array of id's on the itemIds property

Most helpful comment

Hey guys! VThornheart/EdgarVerona here from the Bnet API. You're almost certainly right about the eventual consistency/caching issue - I'll look into it as soon as I can!

All 24 comments

A few things I've learned so far:

  1. EquipItems takes about 450ms, wheras EquipItem takes about 75ms.
  2. EquipItems shares the same throttling key as EquipItem, so you have to queue them together.

Agreed that the benefit would be in plumbing the response back to the store so we don't have to make another call, and the batch-equip after loadouts.

I think the benefit of not having to refresh the character is a no go. Fairly often, the response from EquipItems does not include the updated character info - it reflects the character's state before the equip. Other times it shows the correct info. Sounds like a bug on Bungie's side, probably a read-after-write eventual consistency thing.

Can you write it up and let's report it to Bungie?

Sure, what form would you like that in?

OK, here's the story on EquipItems: https://www.bungie.net/en/Clan/Post/39966/187691777/1

Looks like it isn't going to get a lot of love.

Hey guys! VThornheart/EdgarVerona here from the Bnet API. You're almost certainly right about the eventual consistency/caching issue - I'll look into it as soon as I can!

Thanks @EdgarVerona!

@EdgarVerona any update? No rush, just checking.

I've noticed from using the equipItems call that it is sort of flaky - it fails fairly often. Maybe we should go back to avoiding it.

Unfortunately, I haven't had time to address the issue yet - but it is
still on my mind!

You're experiencing failures using it? Can you send me a log of the
request and response, with at least the bungled cookie in the request? We
can use that to track down log messages on our side related to the failure
you experienced.

On Sat, Apr 16, 2016 at 10:48 AM, Ben Hollis [email protected]
wrote:

I've noticed from using the equipItems call that it is sort of flaky - it
fails fairly often. Maybe we should go back to avoiding it.

โ€”
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/DestinyItemManager/DIM/issues/323#issuecomment-210864549

I'll do that next time I see it!

On Saturday, April 16, 2016, Alex Loret de Mola [email protected]
wrote:

Unfortunately, I haven't had time to address the issue yet - but it is
still on my mind!

You're experiencing failures using it? Can you send me a log of the
request and response, with at least the bungled cookie in the request? We
can use that to track down log messages on our side related to the failure
you experienced.

On Sat, Apr 16, 2016 at 10:48 AM, Ben Hollis <[email protected]
wrote:

I've noticed from using the equipItems call that it is sort of flaky - it
fails fairly often. Maybe we should go back to avoiding it.

โ€”
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
<
https://github.com/DestinyItemManager/DIM/issues/323#issuecomment-210864549

โ€”
You are receiving this because you were assigned.
Reply to this email directly or view it on GitHub
https://github.com/DestinyItemManager/DIM/issues/323#issuecomment-210875243

@EdgarVerona I have a couple of HARs of requests that failed. Would you like me to send them somewhere?

One hunch I have is that if you have an exotic equipped, and you call equipItems on a bunch of items that include an exotic, the exotic equip will fail (order of operations?). Just the exotic will fail with error code 1641.

Would it make sense for us to smooth the landing by unequipping exotics before we use EquipAll in the mean time?

We can also just keep retrying until it works.

On Sat, May 7, 2016 at 9:27 PM, Rick Casey [email protected] wrote:

Would it make sense for us to smooth the landing by unequipping exotics
before we use EquipAll in the mean time?

โ€”
You are receiving this because you were assigned.
Reply to this email directly or view it on GitHub
https://github.com/DestinyItemManager/DIM/issues/323#issuecomment-217690672

Oh! Yeah, for sure! If you've got multiple exotics attempting to be equipped (or an/multiple exotics when you already have one equipped), that will _definitely_ fail. If that's what you're seeing, you'll have to add some messaging on your side for that scenario - we can add some edge case tests for scenarios where we will fail fast, or perhaps even try to change the order of our equipping to make it work, but we have no way to guarantee that it _will_ work, particularly if they ask to perform what amounts to a disallowed action.

If you've got some log messages that are showing failures that aren't in this category and you're having trouble with them, send them over to [email protected] and I'll take a peek!

@bhollis, I don't think retrying will be successful based on @EdgarVerona's reply.

Aye, this is true. Retrying in such a scenario will not succeed. (I should note my "oh yeah, for sure" was in response to the hunch that bhollis had 2 posts above that, and not to retrying ;) )

Retrying definitely works - because I've retried, and it works!

What I'm describing is not trying to equip multiple exotics at once - we won't even try that, because of course it'll fail. Here's what we're actually seeing - this is a reliable repro:

  1. Hunter has a legendary primary equipped, an exotic secondary, and a legendary heavy.
  2. We ask to equip an exotic primary, a legendary secondary, and a legendary heavy (we send the requested item batch in that order!).
  3. Equipping the exotic primary fails, and the other two legendaries are successfully equipped, de-quipping the exotic secondary in the process. Retrying the exact same equipItems operation now works, because the exotic was de-quipped.

Interesting note: if the initial state is an exotic primary, and we ask to equip an exotic secondary (and a legendary primary), that succeeds.

From the outside, it seems like equipItems is taking the batch and just executing it in the order it's given, in serial. I would have expected it would treat it as a single, atomic operation (at least, to the caller of the API), reordering operations such that they would succeed (dequipping exotics before equipping another exotic). Is my assumption correct? If it is, we can do more work on our end to re-order the request to avoid that situation.

Ah, I see what you mean: yeah, in that case it would succeed. And indeed
as you suspect, that is definitely how it works unfortunately. I went into
some detail on equipitems a while ago on the bnet API group because someone
had a similar question: the gist is that we ourselves have no batch
interface for equipping at this time, so the best that we can provide is a
wrapper for commands that are then executed in serial. Saves some round
trips, but indeed it all happens in serial.
On May 8, 2016 12:22 AM, "Ben Hollis" [email protected] wrote:

Retrying definitely works - because I've retried, and it works!

What I'm describing is not trying to equip multiple exotics at once - we
won't even try that, because of course it'll fail. Here's what we're
actually seeing - this is a reliable repro:

  1. Hunter has a legendary primary equipped, an exotic secondary, and a
    legendary heavy.
  2. We ask to equip an exotic primary, a legendary secondary, and a
    legendary heavy (we send the requested item batch in that order!).
  3. Equipping the exotic primary fails, and the other two legendaries
    are successfully equipped, de-quipping the exotic secondary in the process.
    Retrying the exact same equipItems operation now works, because the
    exotic was de-quipped.

Interesting note: if the initial state is an exotic primary, and we ask to
equip an exotic secondary (and a legendary primary), that succeeds.

From the outside, it seems like equipItems is taking the batch and just
executing it in the order it's given, in serial. I would have expected it
would treat it as a single, atomic operation (at least, to the caller of
the API), reordering operations such that they would succeed (dequipping
exotics before equipping another exotic). Is my assumption correct? If it
is, we can do more work on our end to re-order the request to avoid that
situation.

โ€”
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/DestinyItemManager/DIM/issues/323#issuecomment-217699993

The order change to the items is a great idea to fix this.

@EdgarVerona cool. You might want to sort them on your side too, just to avoid this kind of surprise - equipping Exotics as the last step should always succeed, and helps with the illusion that you're doing it as a batch.

Good call, we can definitely make that change!
On May 8, 2016 9:43 AM, "Ben Hollis" [email protected] wrote:

@EdgarVerona https://github.com/EdgarVerona cool. You might want to
sort them on your side too, just to avoid this kind of surprise - equipping
Exotics as the last step should always succeed, and helps with the illusion
that you're doing it as a batch.

โ€”
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/DestinyItemManager/DIM/issues/323#issuecomment-217731770

๐Ÿค—๐Ÿค—๐Ÿค—

On Sunday, May 8, 2016, Alex Loret de Mola [email protected] wrote:

Good call, we can definitely make that change!
On May 8, 2016 9:43 AM, "Ben Hollis" <[email protected]

@EdgarVerona https://github.com/EdgarVerona cool. You might want to
sort them on your side too, just to avoid this kind of surprise -
equipping
Exotics as the last step should always succeed, and helps with the
illusion
that you're doing it as a batch.

โ€”
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
<
https://github.com/DestinyItemManager/DIM/issues/323#issuecomment-217731770

โ€”
You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
https://github.com/DestinyItemManager/DIM/issues/323#issuecomment-217733095

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bhollis picture bhollis  ยท  6Comments

KyoukanGG picture KyoukanGG  ยท  3Comments

delphiactual picture delphiactual  ยท  4Comments

SunburnedGoose picture SunburnedGoose  ยท  4Comments

javalasers picture javalasers  ยท  6Comments