Atomic Swap - What if redeem is done just before expiration As per the explanation provided here: https://github.com/decred/atomicswap

The contract is valid for a certain amount of time (example set to 48h) and in order for the party B to recover the found, he needs the secret that is published on the chain after the party A has redeem the coins on the contract.

As far as I understand, it takes some time for party B to actually recover the secret from the chain and then redeem the coins.

What happens if party A wait last seconds (let's say 5 seconds) before expiration of the contract to redeem the coin, which wouldn't provide enough time for party B to redeem its coin before the contract expiration in which case it would be refunded to party A as well as getting party B coins.

Is the understanding correct and that point valid?

Is it fixable by setting different contract expiration period, lets say party A contract would need longer expiration time to ensure party B ha time to redeem the coins?
As you stated, setting 2 different expiration times provides safety.

My recommendation is to select the network with the longest period before immutability as the first contract, and pick a time that is agreeable with both parties. 

The second contract on the other chain should use an expiry that is half of the first contract. This gives the redeemer on the first blockchain some time before the expiry.