Dry hopping is a wonderful way to impart hop aroma to beer and is very simple to do. In my experience there are a few things to be mindful of to prevent dry hopping-related problems. The first, and most obvious bit of advice is to use hops that smell good. Really, what’s the good of dry hopping with hops that smell off or have an aromatic note that is unpleasant? I personally do not like hops that have any hint of onion or garlic and simply cannot enjoy beer with those types of hop characters. If there is an aroma type you personally dislike, avoid hops with those properties. Do not rely on canned descriptions of a particular variety, instead you should take a small sample, rub it between your hands and smell the hops before deciding whether you will use them.
The second tip is to minimize the risk of oxidizing your beer by dry hopping towards the tail end of fermentation. Compressed hops, whether in the form of pellets or cones, contain some air. Adding the hops to beer while the yeast is active is a great way to scrub oxygen that is added with the hops. And my last tip is to limit the time that you expose your beer to the hops to about a week. The uptake of hop aromatics in beer happens rather quickly and anything longer than about five days does not do much to increase the hoppiness of the beer. What can happen with prolonged exposure to hop matter is the extraction of flavors that are perceived as grassy and astringent.
You have probably noticed that I did not address your basic question about exposure time to hops in the dispensing keg. This is a method that I do not suggest using because it prevents the brewer from controlling the process unless the beer is consumed over a relatively short time frame. Brewers who add hops to cask-conditioned ales know that when a cask is tapped that it will be consumed over a couple of days. Most homebrewers who keg their beers often plan to enjoy their beer for a couple of weeks. During this time period the beer will begin to pick up some of the grassy qualities from the hops. If you want a nice hoppy beer using a process you can control, consider adding the hops in the fermenter before you rack to your keg. I really believe that the results are better and the end result is more repeatable.