Soviet commitment to Afghanistan represent a far smaller proportion of its total military capability compared to American commitment in Vietnam. Afghanistan was by no means soviet union's Vietnam.
In the US, Vietnam had a tremendous impact on domestic politics, as well as overall military procurement, in the end the war led to the political change inside the US that made the war unsustainable.
In the USSR, the war had little impact on domestic politics or military procurement. but domestic politics was undergoing turmoil for its own reasons, in the end the collapse of domestic order made the war unsustainable.
In the US, Vietnam had a tremendous impact on domestic politics, as well as overall military procurement, in the end the war led to the political change inside the US that made the war unsustainable.
In the USSR, the war had little impact on domestic politics or military procurement. but domestic politics was undergoing turmoil for its own reasons, in the end the collapse of domestic order made the war unsustainable.