saw303/grails-ic-alender

A new UidGenerator is being created for each event causing many hostname lookups

Closed this issue · 5 comments

When generating many events at a once, there is a large spike in DNS traffic. After digging through the source, I noticed that a new UidGenerate is created for each event:

currentEvent.properties << new UidGenerator('iCalPlugin-Grails').generateUid()

Looking at the constructor implementation of the net.fortuna.ical4j.util.UidGenerator, you can see that this will create a new InetAddressHostInfo each time, instead of allowing it to just use a cached copy:

    /**
     * @param pid a unique process identifier for the host machine
     * @throws SocketException where host information cannot be retrieved
     */
    public UidGenerator(String pid) throws SocketException {
        this(new InetAddressHostInfo(), pid);
    }

If the UidGenerator was created once per ICalendarBuilder, there would be far less reverse name lookups performed.

Thank you for reporting. I will take a look at it. Are using the Grails 2.x or the Grails 3.x version of the plugin?

I'm using the Grails 2.x version.

Released on Grails 2.x version 0.4.6

Thank you.

you are welcome. Thanks for using the plugin